Apache Lucene open-source search software
LUCENE-4089: add documentation for termsIndexInterval/Divisor
Robert Muir33fd61bb3afe
diff --git a/lucene/core/src/java/org/apache/lucene/index/DirectoryReader.java b/lucene/core/src/java/org/apache/lucene/index/DirectoryReader.javaindex 328ee47e375..beea8ae320a 100644--- a/lucene/core/src/java/org/apache/lucene/index/DirectoryReader.java+++ b/lucene/core/src/java/org/apache/lucene/index/DirectoryReader.java@@ -75,6 +75,9 @@ public abstract class DirectoryReader extends BaseCompositeReader<AtomicReader>* memory usage, at the expense of higher latency when* loading a TermInfo. The default value is 1. Set this* to -1 to skip loading the terms index entirely.+ * <b>NOTE:</b> divisor settings > 1 do not apply to all PostingsFormat+ * implementations, including the default one in this release. It only makes+ * sense for terms indexes that can efficiently re-sample terms at load time.* @throws IOException if there is a low-level IO error*/public static DirectoryReader open(final Directory directory, int termInfosIndexDivisor) throws IOException {@@ -126,6 +129,9 @@ public abstract class DirectoryReader extends BaseCompositeReader<AtomicReader>* memory usage, at the expense of higher latency when* loading a TermInfo. The default value is 1. Set this* to -1 to skip loading the terms index entirely.+ * <b>NOTE:</b> divisor settings > 1 do not apply to all PostingsFormat+ * implementations, including the default one in this release. It only makes+ * sense for terms indexes that can efficiently re-sample terms at load time.* @throws IOException if there is a low-level IO error*/public static DirectoryReader open(final IndexCommit commit, int termInfosIndexDivisor) throws IOException {diff --git a/lucene/core/src/java/org/apache/lucene/index/LiveIndexWriterConfig.java b/lucene/core/src/java/org/apache/lucene/index/LiveIndexWriterConfig.javaindex 738cddbded3..35436848a11 100755--- a/lucene/core/src/java/org/apache/lucene/index/LiveIndexWriterConfig.java+++ b/lucene/core/src/java/org/apache/lucene/index/LiveIndexWriterConfig.java@@ -19,6 +19,7 @@ package org.apache.lucene.index;import org.apache.lucene.analysis.Analyzer;import org.apache.lucene.codecs.Codec;+import org.apache.lucene.codecs.lucene40.Lucene40PostingsFormat; // javadocsimport org.apache.lucene.index.DocumentsWriterPerThread.IndexingChain;import org.apache.lucene.index.IndexWriter.IndexReaderWarmer;import org.apache.lucene.index.IndexWriterConfig.OpenMode;@@ -146,6 +147,29 @@ public class LiveIndexWriterConfig {* Takes effect immediately, but only applies to newly flushed/merged* segments.*+ * <p>+ * <b>NOTE:</b> This parameter does not apply to all PostingsFormat implementations,+ * including the default one in this release. It only makes sense for term indexes+ * that are implemented as a fixed gap between terms. For example,+ * {@link Lucene40PostingsFormat} implements the term index instead based upon how+ * terms share prefixes. To configure its parameters (the minimum and maximum size+ * for a block), you would instead use {@link Lucene40PostingsFormat#Lucene40PostingsFormat(int, int)}.+ * which can also be configured on a per-field basis:+ * <pre class="prettyprint">+ * //customize Lucene40PostingsFormat, passing minBlockSize=50, maxBlockSize=100+ * final PostingsFormat tweakedPostings = new Lucene40PostingsFormat(50, 100);+ * iwc.setCodec(new Lucene40Codec() {+ * @Override+ * public PostingsFormat getPostingsFormatForField(String field) {+ * if (field.equals("fieldWithTonsOfTerms"))+ * return tweakedPostings;+ * else+ * return super.getPostingsFormatForField(field);+ * }+ * });+ * </pre>+ * Note that other implementations may have their own parameters, or no parameters at all.+ ** @see IndexWriterConfig#DEFAULT_TERM_INDEX_INTERVAL*/public LiveIndexWriterConfig setTermIndexInterval(int interval) { // TODO: this should be private to the codec, not settable here@@ -335,6 +359,10 @@ public class LiveIndexWriterConfig {* <p>* Takes effect immediately, but only applies to readers opened after this* call+ * <p>+ * <b>NOTE:</b> divisor settings > 1 do not apply to all PostingsFormat+ * implementations, including the default one in this release. It only makes+ * sense for terms indexes that can efficiently re-sample terms at load time.*/public LiveIndexWriterConfig setReaderTermsIndexDivisor(int divisor) {if (divisor <= 0 && divisor != -1) {