Global.helma.Search.Index.prototype.updateDocument (docObj, fieldName)
Updates the index with the document passed as argument. In contrast to addDocument() this removes any existing objects whose fieldName matches the one of the document object. Eg. if the document object has a field "Id" with the value "123", all document objects whose fieldName "Id" matches "123" will be removed from the index before.

  • Parameter {helma.Search.Document}:
    docObj Document object to add to index.
  • Parameter {String}:
    fieldName The name of the identifier field.
Sourcecode in /home/hannes/helma/modules/helma/Search.js:
581:   helma.Search.Index.prototype.updateDocument = function(docObj, fieldName) {
582:       try {
583:           var modifier = this.getModifier();
584:           var doc = docObj.getDocument();
585:           var term = new Packages.org.apache.lucene.index.Term(fieldName, doc.get(fieldName));
586:           modifier.deleteDocuments(term);
587:           modifier.addDocument(doc);
588:       } finally {
589:           if (modifier != null) {
590:              modifier.close();
591:          }
592:      }
593:      return;
594:  }