lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mikemcc...@apache.org
Subject svn commit: r1649600 - in /lucene/dev/branches/branch_5x: ./ lucene/ lucene/core/ lucene/core/src/java/org/apache/lucene/index/BufferedUpdatesStream.java
Date Mon, 05 Jan 2015 17:55:05 GMT
Author: mikemccand
Date: Mon Jan  5 17:55:05 2015
New Revision: 1649600

URL: http://svn.apache.org/r1649600
Log:
LUCENE-6161: reuse DocsEnum when resolving deleted terms/queries to doc id

Modified:
    lucene/dev/branches/branch_5x/   (props changed)
    lucene/dev/branches/branch_5x/lucene/   (props changed)
    lucene/dev/branches/branch_5x/lucene/core/   (props changed)
    lucene/dev/branches/branch_5x/lucene/core/src/java/org/apache/lucene/index/BufferedUpdatesStream.java

Modified: lucene/dev/branches/branch_5x/lucene/core/src/java/org/apache/lucene/index/BufferedUpdatesStream.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/lucene/core/src/java/org/apache/lucene/index/BufferedUpdatesStream.java?rev=1649600&r1=1649599&r2=1649600&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/lucene/core/src/java/org/apache/lucene/index/BufferedUpdatesStream.java
(original)
+++ lucene/dev/branches/branch_5x/lucene/core/src/java/org/apache/lucene/index/BufferedUpdatesStream.java
Mon Jan  5 17:55:05 2015
@@ -414,7 +414,7 @@ class BufferedUpdatesStream implements A
     TermsEnum termsEnum = null;
 
     String currentField = null;
-    DocsEnum docs = null;
+    DocsEnum docsEnum = null;
 
     assert checkDeleteTerm(null);
 
@@ -439,36 +439,38 @@ class BufferedUpdatesStream implements A
       }
 
       if (termsEnum == null) {
+        // no terms in this field
         continue;
       }
+
       assert checkDeleteTerm(term);
 
       // System.out.println("  term=" + term);
 
       if (termsEnum.seekExact(term.bytes())) {
         // we don't need term frequencies for this
-        DocsEnum docsEnum = termsEnum.docs(rld.getLiveDocs(), docs, DocsEnum.FLAG_NONE);
+        docsEnum = termsEnum.docs(rld.getLiveDocs(), docsEnum, DocsEnum.FLAG_NONE);
         //System.out.println("BDS: got docsEnum=" + docsEnum);
 
-        if (docsEnum != null) {
-          while (true) {
-            final int docID = docsEnum.nextDoc();
-            //System.out.println(Thread.currentThread().getName() + " del term=" + term +
" doc=" + docID);
-            if (docID == DocIdSetIterator.NO_MORE_DOCS) {
-              break;
-            }   
-            if (!any) {
-              rld.initWritableLiveDocs();
-              any = true;
-            }
-            // NOTE: there is no limit check on the docID
-            // when deleting by Term (unlike by Query)
-            // because on flush we apply all Term deletes to
-            // each segment.  So all Term deleting here is
-            // against prior segments:
-            if (rld.delete(docID)) {
-              delCount++;
-            }
+        assert docsEnum != null;
+
+        while (true) {
+          final int docID = docsEnum.nextDoc();
+          //System.out.println(Thread.currentThread().getName() + " del term=" + term + "
doc=" + docID);
+          if (docID == DocIdSetIterator.NO_MORE_DOCS) {
+            break;
+          }   
+          if (!any) {
+            rld.initWritableLiveDocs();
+            any = true;
+          }
+          // NOTE: there is no limit check on the docID
+          // when deleting by Term (unlike by Query)
+          // because on flush we apply all Term deletes to
+          // each segment.  So all Term deleting here is
+          // against prior segments:
+          if (rld.delete(docID)) {
+            delCount++;
           }
         }
       }
@@ -494,7 +496,7 @@ class BufferedUpdatesStream implements A
     
     String currentField = null;
     TermsEnum termsEnum = null;
-    DocsEnum docs = null;
+    DocsEnum docsEnum = null;
     
     //System.out.println(Thread.currentThread().getName() + " numericDVUpdate reader=" +
reader);
     for (DocValuesUpdate update : updates) {
@@ -520,19 +522,19 @@ class BufferedUpdatesStream implements A
           termsEnum = terms.iterator(termsEnum);
         } else {
           termsEnum = null;
-          continue; // no terms in that field
         }
       }
 
       if (termsEnum == null) {
+        // no terms in this field
         continue;
       }
+
       // System.out.println("  term=" + term);
 
       if (termsEnum.seekExact(term.bytes())) {
         // we don't need term frequencies for this
-        DocsEnum docsEnum = termsEnum.docs(rld.getLiveDocs(), docs, DocsEnum.FLAG_NONE);
-      
+        docsEnum = termsEnum.docs(rld.getLiveDocs(), docsEnum, DocsEnum.FLAG_NONE);
         //System.out.println("BDS: got docsEnum=" + docsEnum);
 
         DocValuesFieldUpdates dvUpdates = dvUpdatesContainer.getUpdates(update.field, update.type);



Mime
View raw message