lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mikemcc...@apache.org
Subject svn commit: r1670406 - /lucene/dev/branches/lucene6271/lucene/codecs/src/java/org/apache/lucene/codecs/memory/DirectPostingsFormat.java
Date Tue, 31 Mar 2015 17:40:13 GMT
Author: mikemccand
Date: Tue Mar 31 17:40:12 2015
New Revision: 1670406

URL: http://svn.apache.org/r1670406
Log:
LUCENE-6271: DirectPF was using the wrong PostingsEnum impl for the incoming requested flags

Modified:
    lucene/dev/branches/lucene6271/lucene/codecs/src/java/org/apache/lucene/codecs/memory/DirectPostingsFormat.java

Modified: lucene/dev/branches/lucene6271/lucene/codecs/src/java/org/apache/lucene/codecs/memory/DirectPostingsFormat.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6271/lucene/codecs/src/java/org/apache/lucene/codecs/memory/DirectPostingsFormat.java?rev=1670406&r1=1670405&r2=1670406&view=diff
==============================================================================
--- lucene/dev/branches/lucene6271/lucene/codecs/src/java/org/apache/lucene/codecs/memory/DirectPostingsFormat.java
(original)
+++ lucene/dev/branches/lucene6271/lucene/codecs/src/java/org/apache/lucene/codecs/memory/DirectPostingsFormat.java
Tue Mar 31 17:40:12 2015
@@ -866,7 +866,20 @@ public final class DirectPostingsFormat
           if (terms[termOrd] instanceof LowFreqTerm) {
             final LowFreqTerm term = ((LowFreqTerm) terms[termOrd]);
             final int[] postings = term.postings;
-            if (hasPos == false) {
+            if (hasFreq == false) {
+              LowFreqDocsEnumNoTF docsEnum;
+              if (reuse instanceof LowFreqDocsEnumNoTF) {
+                docsEnum = (LowFreqDocsEnumNoTF) reuse;
+                if (!docsEnum.canReuse(liveDocs)) {
+                  docsEnum = new LowFreqDocsEnumNoTF(liveDocs);
+                }
+              } else {
+                docsEnum = new LowFreqDocsEnumNoTF(liveDocs);
+              }
+
+              return docsEnum.reset(postings);
+              
+            } else if (hasPos == false) {
               LowFreqDocsEnumNoPos docsEnum;
               if (reuse instanceof LowFreqDocsEnumNoPos) {
                 docsEnum = (LowFreqDocsEnumNoPos) reuse;
@@ -883,7 +896,11 @@ public final class DirectPostingsFormat
             return new LowFreqPostingsEnum(liveDocs, hasOffsets, hasPayloads).reset(postings,
payloads);
           } else {
             final HighFreqTerm term = (HighFreqTerm) terms[termOrd];
-            return new HighFreqPostingsEnum(liveDocs, hasOffsets).reset(term.docIDs, term.freqs,
term.positions, term.payloads);
+            if (hasPos == false) {
+              return new HighFreqDocsEnum(liveDocs).reset(term.docIDs, term.freqs);
+            } else {
+              return new HighFreqPostingsEnum(liveDocs, hasOffsets).reset(term.docIDs, term.freqs,
term.positions, term.payloads);
+            }
           }
         }
 



Mime
View raw message