Apache Lucene open-source search software
LUCENE-3708: always call postingswriter.finishDoc when writing postings
Robert Muir3c6d62edbbb8
diff --git a/lucene/src/java/org/apache/lucene/codecs/PostingsConsumer.java b/lucene/src/java/org/apache/lucene/codecs/PostingsConsumer.javaindex 32cbc8e1d50..8cd3e69ae63 100644--- a/lucene/src/java/org/apache/lucene/codecs/PostingsConsumer.java+++ b/lucene/src/java/org/apache/lucene/codecs/PostingsConsumer.java@@ -33,9 +33,7 @@ import org.apache.lucene.util.FixedBitSet;public abstract class PostingsConsumer {- /** Adds a new doc in this term. If this field omits term- * freqs & positions then termDocFreq should be ignored,- * and, finishDoc will not be called. */+ /** Adds a new doc in this term. */public abstract void startDoc(int docID, int termDocFreq) throws IOException;public static class PostingsMergeState {@@ -52,8 +50,7 @@ public abstract class PostingsConsumer {public abstract void addPosition(int position, BytesRef payload, int startOffset, int endOffset) throws IOException;/** Called when we are done adding positions & payloads- * for each doc. Not called when the field omits term- * freq and positions. */+ * for each doc. */public abstract void finishDoc() throws IOException;/** Default merge impl: append documents, mapping arounddiff --git a/lucene/src/java/org/apache/lucene/index/FreqProxTermsWriterPerField.java b/lucene/src/java/org/apache/lucene/index/FreqProxTermsWriterPerField.javaindex 7852ebf0dce..30a8028cb73 100644--- a/lucene/src/java/org/apache/lucene/index/FreqProxTermsWriterPerField.java+++ b/lucene/src/java/org/apache/lucene/index/FreqProxTermsWriterPerField.java@@ -517,9 +517,8 @@ final class FreqProxTermsWriterPerField extends TermsHashConsumerPerField implem}}}-- postingsConsumer.finishDoc();}+ postingsConsumer.finishDoc();}termsConsumer.finishTerm(text, new TermStats(numDocs, totTF));sumTotalTermFreq += totTF;