Global.helma.Search.Index.prototype.removeDocuments (fieldName, values)
Removes all documents whose field with the given name matches the values passed as argument.

  • Parameter {String}:
    fieldName The name of the field
  • Parameter {java.util.Hashtable:
    | java.util.Vector | Array} values The values that define the documents that should be removed from the index.
  • Returns
    An array containing the numbers of deleted documents for each field value.
Sourcecode in /home/hannes/helma/modules/helma/Search.js:
546:   helma.Search.Index.prototype.removeDocuments = function(fieldName, values) {
547:       try {
548:           var modifier = this.getModifier();
549:           var term, result = [];
550:           if (values instanceof java.util.Hashtable ||
551:                   values instanceof java.util.Vector) {
552:               var e = values.elements();
553:               while (e.hasMoreElements()) {
554:                   term = new Packages.org.apache.lucene.index.Term(fieldName, e.nextElement());
555:                  result.push(modifier.deleteDocuments(term));
556:              }
557:              return result;
558:          } else if (values instanceof Array) {
559:              for (var i=0;i<values.length;i++) {
560:                  term = new Packages.org.apache.lucene.index.Term(fieldName, values[i]);
561:                  result.push(modifier.deleteDocuments(term));
562:              }
563:          }
564:      } finally {
565:          if (modifier != null) {
566:              modifier.close();
567:          }
568:      }
569:      return;
570:  }