mirror of https://github.com/apache/lucene.git
cutover Pulsing to var gap terms index
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1074879 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
3985b909e7
commit
700804bfbf
|
@ -30,15 +30,14 @@ import org.apache.lucene.index.codecs.PostingsReaderBase;
|
||||||
import org.apache.lucene.index.codecs.standard.StandardPostingsReader;
|
import org.apache.lucene.index.codecs.standard.StandardPostingsReader;
|
||||||
import org.apache.lucene.index.codecs.FieldsConsumer;
|
import org.apache.lucene.index.codecs.FieldsConsumer;
|
||||||
import org.apache.lucene.index.codecs.FieldsProducer;
|
import org.apache.lucene.index.codecs.FieldsProducer;
|
||||||
import org.apache.lucene.index.codecs.FixedGapTermsIndexReader;
|
import org.apache.lucene.index.codecs.VariableGapTermsIndexReader;
|
||||||
import org.apache.lucene.index.codecs.FixedGapTermsIndexWriter;
|
import org.apache.lucene.index.codecs.VariableGapTermsIndexWriter;
|
||||||
import org.apache.lucene.index.codecs.BlockTermsReader;
|
import org.apache.lucene.index.codecs.BlockTermsReader;
|
||||||
import org.apache.lucene.index.codecs.BlockTermsWriter;
|
import org.apache.lucene.index.codecs.BlockTermsWriter;
|
||||||
import org.apache.lucene.index.codecs.TermsIndexReaderBase;
|
import org.apache.lucene.index.codecs.TermsIndexReaderBase;
|
||||||
import org.apache.lucene.index.codecs.TermsIndexWriterBase;
|
import org.apache.lucene.index.codecs.TermsIndexWriterBase;
|
||||||
import org.apache.lucene.index.codecs.standard.StandardCodec;
|
import org.apache.lucene.index.codecs.standard.StandardCodec;
|
||||||
import org.apache.lucene.store.Directory;
|
import org.apache.lucene.store.Directory;
|
||||||
import org.apache.lucene.util.BytesRef;
|
|
||||||
|
|
||||||
/** This codec "inlines" the postings for terms that have
|
/** This codec "inlines" the postings for terms that have
|
||||||
* low docFreq. It wraps another codec, which is used for
|
* low docFreq. It wraps another codec, which is used for
|
||||||
|
@ -78,7 +77,7 @@ public class PulsingCodec extends Codec {
|
||||||
TermsIndexWriterBase indexWriter;
|
TermsIndexWriterBase indexWriter;
|
||||||
boolean success = false;
|
boolean success = false;
|
||||||
try {
|
try {
|
||||||
indexWriter = new FixedGapTermsIndexWriter(state);
|
indexWriter = new VariableGapTermsIndexWriter(state, new VariableGapTermsIndexWriter.EveryNTermSelector(state.termIndexInterval));
|
||||||
success = true;
|
success = true;
|
||||||
} finally {
|
} finally {
|
||||||
if (!success) {
|
if (!success) {
|
||||||
|
@ -116,12 +115,11 @@ public class PulsingCodec extends Codec {
|
||||||
|
|
||||||
boolean success = false;
|
boolean success = false;
|
||||||
try {
|
try {
|
||||||
indexReader = new FixedGapTermsIndexReader(state.dir,
|
indexReader = new VariableGapTermsIndexReader(state.dir,
|
||||||
state.fieldInfos,
|
state.fieldInfos,
|
||||||
state.segmentInfo.name,
|
state.segmentInfo.name,
|
||||||
state.termsIndexDivisor,
|
state.termsIndexDivisor,
|
||||||
BytesRef.getUTF8SortedAsUnicodeComparator(),
|
state.codecId);
|
||||||
state.codecId);
|
|
||||||
success = true;
|
success = true;
|
||||||
} finally {
|
} finally {
|
||||||
if (!success) {
|
if (!success) {
|
||||||
|
@ -155,7 +153,7 @@ public class PulsingCodec extends Codec {
|
||||||
public void files(Directory dir, SegmentInfo segmentInfo, String id, Set<String> files) throws IOException {
|
public void files(Directory dir, SegmentInfo segmentInfo, String id, Set<String> files) throws IOException {
|
||||||
StandardPostingsReader.files(dir, segmentInfo, id, files);
|
StandardPostingsReader.files(dir, segmentInfo, id, files);
|
||||||
BlockTermsReader.files(dir, segmentInfo, id, files);
|
BlockTermsReader.files(dir, segmentInfo, id, files);
|
||||||
FixedGapTermsIndexReader.files(dir, segmentInfo, id, files);
|
VariableGapTermsIndexReader.files(dir, segmentInfo, id, files);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue