lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Yonik Seeley" <>
Subject Re: [jira] Commented: (LUCENE-565) Supporting deleteDocuments in IndexWriter (Code and Performance Results Provided)
Date Mon, 10 Jul 2006 21:34:28 GMT
Random comment...
when applying deletes you can break out of the loop early.

+               while ( {
+                  int doc = docs.doc();
+                  if (doc <=
(((DeleteTerm)deleteTerms.elementAt(i)).maxSegment)) {
+                     reader.deleteDocument(doc);
+                  }
+               }

can be changed to

              while ( {
                  int doc = docs.doc();
                  if (doc >
(((DeleteTerm)deleteTerms.elementAt(i)).maxSegment)) break;

An alternate implementation could use a HashMap to associate term with
That would make deletions more efficient for multiple deletes on the
same term (this can easily happen if there are a set of frequently
updated documents).

Solr does much the same thing, except since it doesn't have access to
IndexWriter internals, it keeps track of the number of documents *not*
to delete for a certain term.  An add increases the count, and a
delete resets the count to zero.

-Yonik Solr, the open-source Lucene search server

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message