Apache Lucene open-source search software
LUCENE-3069: update javadocs, fix impersonator bug
Han Jiangec07c84339da
diff --git a/lucene/codecs/src/java/org/apache/lucene/codecs/blockterms/BlockTermsWriter.java b/lucene/codecs/src/java/org/apache/lucene/codecs/blockterms/BlockTermsWriter.javaindex e607f117445..2bd8c91b605 100644--- a/lucene/codecs/src/java/org/apache/lucene/codecs/blockterms/BlockTermsWriter.java+++ b/lucene/codecs/src/java/org/apache/lucene/codecs/blockterms/BlockTermsWriter.java@@ -61,8 +61,7 @@ public class BlockTermsWriter extends FieldsConsumer {public static final int VERSION_START = 0;public static final int VERSION_APPEND_ONLY = 1;public static final int VERSION_META_ARRAY = 2;- public static final int VERSION_CURRENT = VERSION_APPEND_ONLY;- //public static final int VERSION_CURRENT = VERSION_META_ARRAY;+ public static final int VERSION_CURRENT = VERSION_META_ARRAY;/** Extension of terms file */static final String TERMS_EXTENSION = "tib";diff --git a/lucene/codecs/src/java/org/apache/lucene/codecs/pulsing/PulsingPostingsWriter.java b/lucene/codecs/src/java/org/apache/lucene/codecs/pulsing/PulsingPostingsWriter.javaindex 1ab6f75a430..db1603532ad 100644--- a/lucene/codecs/src/java/org/apache/lucene/codecs/pulsing/PulsingPostingsWriter.java+++ b/lucene/codecs/src/java/org/apache/lucene/codecs/pulsing/PulsingPostingsWriter.java@@ -63,8 +63,7 @@ public final class PulsingPostingsWriter extends PostingsWriterBase {final static int VERSION_META_ARRAY = 1;- //final static int VERSION_CURRENT = VERSION_META_ARRAY;- final static int VERSION_CURRENT = VERSION_START;+ final static int VERSION_CURRENT = VERSION_META_ARRAY;private SegmentWriteState segmentState;private IndexOutput termsOut;diff --git a/lucene/codecs/src/java/org/apache/lucene/codecs/temp/TempTermOutputs.java b/lucene/codecs/src/java/org/apache/lucene/codecs/temp/TempTermOutputs.javaindex 9cf80102742..20482a1951e 100644--- a/lucene/codecs/src/java/org/apache/lucene/codecs/temp/TempTermOutputs.java+++ b/lucene/codecs/src/java/org/apache/lucene/codecs/temp/TempTermOutputs.java@@ -187,8 +187,8 @@ public class TempTermOutputs extends Outputs<TempTermOutputs.TempMetaData> {}// TODO: if we refactor a 'addSelf(TempMetaDat other)',- // we can gain about 5~7% for fuzzy queries, however on the other hand- // we seem to put much stress on FST Outputs decoding?+ // we can gain about 5~7% for fuzzy queries, however this also+ // means we are putting too much stress on FST Outputs decoding?@Overridepublic TempMetaData add(TempMetaData t1, TempMetaData t2) {//if (TEST) System.out.print("add("+t1+", "+t2+") = ");diff --git a/lucene/core/src/java/org/apache/lucene/codecs/BlockTreeTermsWriter.java b/lucene/core/src/java/org/apache/lucene/codecs/BlockTreeTermsWriter.javaindex 8d825e6c8d7..b79d4f4f304 100644--- a/lucene/core/src/java/org/apache/lucene/codecs/BlockTreeTermsWriter.java+++ b/lucene/core/src/java/org/apache/lucene/codecs/BlockTreeTermsWriter.java@@ -209,7 +209,7 @@ public class BlockTreeTermsWriter extends FieldsConsumer {public static final int TERMS_VERSION_META_ARRAY = 2;/** Current terms format. */- public static final int TERMS_VERSION_CURRENT = TERMS_VERSION_APPEND_ONLY;+ public static final int TERMS_VERSION_CURRENT = TERMS_VERSION_META_ARRAY;/** Extension of terms index file */static final String TERMS_INDEX_EXTENSION = "tip";@@ -225,7 +225,7 @@ public class BlockTreeTermsWriter extends FieldsConsumer {public static final int TERMS_INDEX_VERSION_META_ARRAY = 2;/** Current index format. */- public static final int TERMS_INDEX_VERSION_CURRENT = TERMS_INDEX_VERSION_APPEND_ONLY;+ public static final int TERMS_INDEX_VERSION_CURRENT = TERMS_INDEX_VERSION_META_ARRAY;private final IndexOutput out;private final IndexOutput indexOut;diff --git a/lucene/core/src/java/org/apache/lucene/codecs/PostingsReaderBase.java b/lucene/core/src/java/org/apache/lucene/codecs/PostingsReaderBase.javaindex 58c7a87253c..c591fa270c3 100644--- a/lucene/core/src/java/org/apache/lucene/codecs/PostingsReaderBase.java+++ b/lucene/core/src/java/org/apache/lucene/codecs/PostingsReaderBase.java@@ -55,7 +55,9 @@ public abstract class PostingsReaderBase implements Closeable {/** Return a newly created empty TermState */public abstract BlockTermState newTermState() throws IOException;- /** Actually decode metadata for next term */+ /** Actually decode metadata for next term+ * @see PostingsWriterBase#encodeTerm+ */public abstract void decodeTerm(long[] longs, DataInput in, FieldInfo fieldInfo, BlockTermState state, boolean absolute) throws IOException;/** Must fully consume state, since after this call thatdiff --git a/lucene/core/src/java/org/apache/lucene/codecs/PostingsWriterBase.java b/lucene/core/src/java/org/apache/lucene/codecs/PostingsWriterBase.javaindex cf88fddc546..e03ee733ee1 100644--- a/lucene/core/src/java/org/apache/lucene/codecs/PostingsWriterBase.java+++ b/lucene/core/src/java/org/apache/lucene/codecs/PostingsWriterBase.java@@ -65,13 +65,17 @@ public abstract class PostingsWriterBase extends PostingsConsumer implements Clopublic abstract void finishTerm(BlockTermState state) throws IOException;/**- * Encode metadata as long[] and byte[]. {@code absolute} controls- * whether current term is delta encoded according to latest term.+ * Encode metadata as long[] and byte[]. {@code absolute} controls whether+ * current term is delta encoded according to latest term.+ * Usually elements in {@code longs} are file pointers, so each one always+ * increases when a new term is consumed. {@code out} is used to write generic+ * bytes, which are not monotonical.*- * NOTE: sometimes long[] might contain values that doesn't make sense,- * e.g. for Lucene41PostingsFormat, when singletonDocID != -1, docStartFP is not defined.- * Here postings side should always use the last docStartFP, to keep each element in- * metadata long[] monotonic.+ * NOTE: sometimes long[] might contain values that doesn't make sense, e.g.+ * the pointer to postings list may not be defined, if it is designed to inline+ * some postings data in term dictionary. For this the postings side should+ * always use the last file pointer, so that each element in metadata long[] is+ * still monotonic.*/public abstract void encodeTerm(long[] longs, DataOutput out, FieldInfo fieldInfo, BlockTermState state, boolean absolute) throws IOException;diff --git a/lucene/core/src/java/org/apache/lucene/codecs/lucene41/Lucene41PostingsWriter.java b/lucene/core/src/java/org/apache/lucene/codecs/lucene41/Lucene41PostingsWriter.javaindex f40ca9c0c49..0ca8aa423ca 100644--- a/lucene/core/src/java/org/apache/lucene/codecs/lucene41/Lucene41PostingsWriter.java+++ b/lucene/core/src/java/org/apache/lucene/codecs/lucene41/Lucene41PostingsWriter.java@@ -67,8 +67,8 @@ public final class Lucene41PostingsWriter extends PostingsWriterBase {// Increment version to change itfinal static int VERSION_START = 0;final static int VERSION_META_ARRAY = 1;- final static int VERSION_CURRENT = VERSION_START;- //final static int VERSION_CURRENT = VERSION_META_ARRAY;+ //final static int VERSION_CURRENT = VERSION_START;+ final static int VERSION_CURRENT = VERSION_META_ARRAY;final IndexOutput docOut;final IndexOutput posOut;@@ -519,7 +519,7 @@ public final class Lucene41PostingsWriter extends PostingsWriterBase {// System.out.println(" no skip: docCount=" + docCount);// }}- if (state.totalTermFreq >= BLOCK_SIZE) {+ if (VERSION_CURRENT >= VERSION_META_ARRAY || state.totalTermFreq >= BLOCK_SIZE) {state.payTermStartFP = payTermStartFP;} else {state.payTermStartFP = -1;@@ -552,11 +552,7 @@ public final class Lucene41PostingsWriter extends PostingsWriterBase {if (fieldHasPositions) {longs[1] = state.posTermStartFP - lastState.posTermStartFP;if (fieldHasPayloads || fieldHasOffsets) {- if (state.payTermStartFP == -1) {- longs[2] = 0;- } else {- longs[2] = state.payTermStartFP - lastState.payTermStartFP;- }+ longs[2] = state.payTermStartFP - lastState.payTermStartFP;}}if (state.singletonDocID != -1) {