mirror of https://github.com/apache/lucene.git
LUCENE-4391: Make Lucene40Codec's methods final.
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1387222 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
08abdb0dc5
commit
88adeb0b28
|
@ -52,6 +52,10 @@ New Features
|
||||||
|
|
||||||
API Changes
|
API Changes
|
||||||
|
|
||||||
|
* LUCENE-4391: All methods of Lucene40Codec but getPostingsFormatForField are
|
||||||
|
now final. To reuse functionality of Lucene40, you should extend FilterCodec
|
||||||
|
and delegate to Lucene40 instead of extending Lucene40Codec. (Adrien Grand)
|
||||||
|
|
||||||
* LUCENE-4299: Added Terms.hasPositions() and Terms.hasOffsets().
|
* LUCENE-4299: Added Terms.hasPositions() and Terms.hasOffsets().
|
||||||
Previously you had no real way to know that a term vector field
|
Previously you had no real way to know that a term vector field
|
||||||
had positions or offsets, since this can be configured on a
|
had positions or offsets, since this can be configured on a
|
||||||
|
|
|
@ -18,22 +18,9 @@ package org.apache.lucene.codecs.appending;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import org.apache.lucene.codecs.Codec;
|
import org.apache.lucene.codecs.Codec;
|
||||||
import org.apache.lucene.codecs.DocValuesFormat;
|
import org.apache.lucene.codecs.FilterCodec;
|
||||||
import org.apache.lucene.codecs.FieldInfosFormat;
|
|
||||||
import org.apache.lucene.codecs.LiveDocsFormat;
|
|
||||||
import org.apache.lucene.codecs.NormsFormat;
|
|
||||||
import org.apache.lucene.codecs.PostingsFormat;
|
import org.apache.lucene.codecs.PostingsFormat;
|
||||||
import org.apache.lucene.codecs.SegmentInfoFormat;
|
|
||||||
import org.apache.lucene.codecs.StoredFieldsFormat;
|
|
||||||
import org.apache.lucene.codecs.TermVectorsFormat;
|
|
||||||
import org.apache.lucene.codecs.lucene40.Lucene40Codec;
|
import org.apache.lucene.codecs.lucene40.Lucene40Codec;
|
||||||
import org.apache.lucene.codecs.lucene40.Lucene40DocValuesFormat;
|
|
||||||
import org.apache.lucene.codecs.lucene40.Lucene40FieldInfosFormat;
|
|
||||||
import org.apache.lucene.codecs.lucene40.Lucene40LiveDocsFormat;
|
|
||||||
import org.apache.lucene.codecs.lucene40.Lucene40NormsFormat;
|
|
||||||
import org.apache.lucene.codecs.lucene40.Lucene40SegmentInfoFormat;
|
|
||||||
import org.apache.lucene.codecs.lucene40.Lucene40StoredFieldsFormat;
|
|
||||||
import org.apache.lucene.codecs.lucene40.Lucene40TermVectorsFormat;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This codec uses an index format that is very similar to
|
* This codec uses an index format that is very similar to
|
||||||
|
@ -42,57 +29,22 @@ import org.apache.lucene.codecs.lucene40.Lucene40TermVectorsFormat;
|
||||||
*
|
*
|
||||||
* @lucene.experimental
|
* @lucene.experimental
|
||||||
*/
|
*/
|
||||||
public class AppendingCodec extends Codec {
|
public final class AppendingCodec extends FilterCodec {
|
||||||
|
|
||||||
public AppendingCodec() {
|
public AppendingCodec() {
|
||||||
super("Appending");
|
super("Appending");
|
||||||
}
|
}
|
||||||
|
|
||||||
private final PostingsFormat postings = new AppendingPostingsFormat();
|
private final PostingsFormat postings = new AppendingPostingsFormat();
|
||||||
private final SegmentInfoFormat infos = new Lucene40SegmentInfoFormat();
|
|
||||||
private final StoredFieldsFormat fields = new Lucene40StoredFieldsFormat();
|
@Override
|
||||||
private final FieldInfosFormat fieldInfos = new Lucene40FieldInfosFormat();
|
protected Codec delegate() {
|
||||||
private final TermVectorsFormat vectors = new Lucene40TermVectorsFormat();
|
return Codec.forName("Lucene40");
|
||||||
private final DocValuesFormat docValues = new Lucene40DocValuesFormat();
|
}
|
||||||
private final NormsFormat norms = new Lucene40NormsFormat();
|
|
||||||
private final LiveDocsFormat liveDocs = new Lucene40LiveDocsFormat();
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PostingsFormat postingsFormat() {
|
public PostingsFormat postingsFormat() {
|
||||||
return postings;
|
return postings;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public StoredFieldsFormat storedFieldsFormat() {
|
|
||||||
return fields;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public TermVectorsFormat termVectorsFormat() {
|
|
||||||
return vectors;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public DocValuesFormat docValuesFormat() {
|
|
||||||
return docValues;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public SegmentInfoFormat segmentInfoFormat() {
|
|
||||||
return infos;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public FieldInfosFormat fieldInfosFormat() {
|
|
||||||
return fieldInfos;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public NormsFormat normsFormat() {
|
|
||||||
return norms;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public LiveDocsFormat liveDocsFormat() {
|
|
||||||
return liveDocs;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,7 @@ import org.apache.lucene.index.SegmentWriteState;
|
||||||
/**
|
/**
|
||||||
* Appending postings impl.
|
* Appending postings impl.
|
||||||
*/
|
*/
|
||||||
class AppendingPostingsFormat extends PostingsFormat {
|
final class AppendingPostingsFormat extends PostingsFormat {
|
||||||
public static String CODEC_NAME = "Appending";
|
public static String CODEC_NAME = "Appending";
|
||||||
|
|
||||||
public AppendingPostingsFormat() {
|
public AppendingPostingsFormat() {
|
||||||
|
|
|
@ -80,7 +80,7 @@ import org.apache.lucene.util.automaton.CompiledAutomaton;
|
||||||
* </ul>
|
* </ul>
|
||||||
* @lucene.experimental
|
* @lucene.experimental
|
||||||
*/
|
*/
|
||||||
public class BloomFilteringPostingsFormat extends PostingsFormat {
|
public final class BloomFilteringPostingsFormat extends PostingsFormat {
|
||||||
|
|
||||||
public static final String BLOOM_CODEC_NAME = "BloomFilter";
|
public static final String BLOOM_CODEC_NAME = "BloomFilter";
|
||||||
public static final int BLOOM_CODEC_VERSION = 1;
|
public static final int BLOOM_CODEC_VERSION = 1;
|
||||||
|
|
|
@ -71,7 +71,7 @@ import org.apache.lucene.util.automaton.Transition;
|
||||||
*
|
*
|
||||||
* @lucene.experimental */
|
* @lucene.experimental */
|
||||||
|
|
||||||
public class DirectPostingsFormat extends PostingsFormat {
|
public final class DirectPostingsFormat extends PostingsFormat {
|
||||||
|
|
||||||
private final int minSkipCount;
|
private final int minSkipCount;
|
||||||
private final int lowFreqCutoff;
|
private final int lowFreqCutoff;
|
||||||
|
|
|
@ -79,7 +79,7 @@ import org.apache.lucene.util.packed.PackedInts;
|
||||||
// TODO: Maybe name this 'Cached' or something to reflect
|
// TODO: Maybe name this 'Cached' or something to reflect
|
||||||
// the reality that it is actually written to disk, but
|
// the reality that it is actually written to disk, but
|
||||||
// loads itself in ram?
|
// loads itself in ram?
|
||||||
public class MemoryPostingsFormat extends PostingsFormat {
|
public final class MemoryPostingsFormat extends PostingsFormat {
|
||||||
|
|
||||||
private final boolean doPackFST;
|
private final boolean doPackFST;
|
||||||
private final float acceptableOverheadRatio;
|
private final float acceptableOverheadRatio;
|
||||||
|
|
|
@ -34,7 +34,7 @@ import org.apache.lucene.index.IndexFileNames;
|
||||||
* any text editor, and even edit it to alter your index.
|
* any text editor, and even edit it to alter your index.
|
||||||
*
|
*
|
||||||
* @lucene.experimental */
|
* @lucene.experimental */
|
||||||
public class SimpleTextPostingsFormat extends PostingsFormat {
|
public final class SimpleTextPostingsFormat extends PostingsFormat {
|
||||||
|
|
||||||
public SimpleTextPostingsFormat() {
|
public SimpleTextPostingsFormat() {
|
||||||
super("SimpleText");
|
super("SimpleText");
|
||||||
|
|
|
@ -0,0 +1,96 @@
|
||||||
|
package org.apache.lucene.codecs;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
|
* contributor license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright ownership.
|
||||||
|
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||||
|
* (the "License"); you may not use this file except in compliance with
|
||||||
|
* the License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A codec that forwards all its method calls to another codec.
|
||||||
|
* <p>
|
||||||
|
* Extend this class when you need to reuse the functionality of an existing
|
||||||
|
* codec. For example, if you want to build a codec that redefines Lucene40's
|
||||||
|
* {@link LiveDocsFormat}:
|
||||||
|
* <pre class="prettyprint">
|
||||||
|
* public final class CustomCodec extends FilterCodec {
|
||||||
|
*
|
||||||
|
* public CustomCodec() {
|
||||||
|
* super("CustomCodec");
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* public Codec delegate() {
|
||||||
|
* return Codec.forName("Lucene40");
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* public LiveDocsFormat liveDocsFormat() {
|
||||||
|
* return new CustomLiveDocsFormat();
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* }
|
||||||
|
* </pre>
|
||||||
|
*/
|
||||||
|
public abstract class FilterCodec extends Codec {
|
||||||
|
|
||||||
|
public FilterCodec(String name) {
|
||||||
|
super(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the codec that is responsible for providing default format
|
||||||
|
* implementations.
|
||||||
|
*/
|
||||||
|
protected abstract Codec delegate();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DocValuesFormat docValuesFormat() {
|
||||||
|
return delegate().docValuesFormat();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public FieldInfosFormat fieldInfosFormat() {
|
||||||
|
return delegate().fieldInfosFormat();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public LiveDocsFormat liveDocsFormat() {
|
||||||
|
return delegate().liveDocsFormat();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public NormsFormat normsFormat() {
|
||||||
|
return delegate().normsFormat();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PostingsFormat postingsFormat() {
|
||||||
|
return delegate().postingsFormat();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SegmentInfoFormat segmentInfoFormat() {
|
||||||
|
return delegate().segmentInfoFormat();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public StoredFieldsFormat storedFieldsFormat() {
|
||||||
|
return delegate().storedFieldsFormat();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TermVectorsFormat termVectorsFormat() {
|
||||||
|
return delegate().termVectorsFormat();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -20,6 +20,7 @@ package org.apache.lucene.codecs.lucene40;
|
||||||
import org.apache.lucene.codecs.Codec;
|
import org.apache.lucene.codecs.Codec;
|
||||||
import org.apache.lucene.codecs.DocValuesFormat;
|
import org.apache.lucene.codecs.DocValuesFormat;
|
||||||
import org.apache.lucene.codecs.FieldInfosFormat;
|
import org.apache.lucene.codecs.FieldInfosFormat;
|
||||||
|
import org.apache.lucene.codecs.FilterCodec;
|
||||||
import org.apache.lucene.codecs.LiveDocsFormat;
|
import org.apache.lucene.codecs.LiveDocsFormat;
|
||||||
import org.apache.lucene.codecs.NormsFormat;
|
import org.apache.lucene.codecs.NormsFormat;
|
||||||
import org.apache.lucene.codecs.PostingsFormat;
|
import org.apache.lucene.codecs.PostingsFormat;
|
||||||
|
@ -30,6 +31,9 @@ import org.apache.lucene.codecs.perfield.PerFieldPostingsFormat;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implements the Lucene 4.0 index format, with configurable per-field postings formats.
|
* Implements the Lucene 4.0 index format, with configurable per-field postings formats.
|
||||||
|
* <p>
|
||||||
|
* If you want to reuse functionality of this codec in another codec, extend
|
||||||
|
* {@link FilterCodec}.
|
||||||
*
|
*
|
||||||
* @see org.apache.lucene.codecs.lucene40 package documentation for file format details.
|
* @see org.apache.lucene.codecs.lucene40 package documentation for file format details.
|
||||||
* @lucene.experimental
|
* @lucene.experimental
|
||||||
|
@ -58,42 +62,42 @@ public class Lucene40Codec extends Codec {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public StoredFieldsFormat storedFieldsFormat() {
|
public final StoredFieldsFormat storedFieldsFormat() {
|
||||||
return fieldsFormat;
|
return fieldsFormat;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TermVectorsFormat termVectorsFormat() {
|
public final TermVectorsFormat termVectorsFormat() {
|
||||||
return vectorsFormat;
|
return vectorsFormat;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DocValuesFormat docValuesFormat() {
|
public final DocValuesFormat docValuesFormat() {
|
||||||
return docValuesFormat;
|
return docValuesFormat;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PostingsFormat postingsFormat() {
|
public final PostingsFormat postingsFormat() {
|
||||||
return postingsFormat;
|
return postingsFormat;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public FieldInfosFormat fieldInfosFormat() {
|
public final FieldInfosFormat fieldInfosFormat() {
|
||||||
return fieldInfosFormat;
|
return fieldInfosFormat;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SegmentInfoFormat segmentInfoFormat() {
|
public final SegmentInfoFormat segmentInfoFormat() {
|
||||||
return infosFormat;
|
return infosFormat;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public NormsFormat normsFormat() {
|
public final NormsFormat normsFormat() {
|
||||||
return normsFormat;
|
return normsFormat;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public LiveDocsFormat liveDocsFormat() {
|
public final LiveDocsFormat liveDocsFormat() {
|
||||||
return liveDocsFormat;
|
return liveDocsFormat;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -269,7 +269,7 @@ import org.apache.lucene.util.fst.FST; // javadocs
|
||||||
// TODO: this class could be created by wrapping
|
// TODO: this class could be created by wrapping
|
||||||
// BlockTreeTermsDict around Lucene40PostingsBaseFormat; ie
|
// BlockTreeTermsDict around Lucene40PostingsBaseFormat; ie
|
||||||
// we should not duplicate the code from that class here:
|
// we should not duplicate the code from that class here:
|
||||||
public class Lucene40PostingsFormat extends PostingsFormat {
|
public final class Lucene40PostingsFormat extends PostingsFormat {
|
||||||
|
|
||||||
private final int minBlockSize;
|
private final int minBlockSize;
|
||||||
private final int maxBlockSize;
|
private final int maxBlockSize;
|
||||||
|
|
|
@ -63,7 +63,7 @@ public abstract class PerFieldPostingsFormat extends PostingsFormat {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public FieldsConsumer fieldsConsumer(SegmentWriteState state)
|
public final FieldsConsumer fieldsConsumer(SegmentWriteState state)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
return new FieldsWriter(state);
|
return new FieldsWriter(state);
|
||||||
}
|
}
|
||||||
|
@ -220,7 +220,7 @@ public abstract class PerFieldPostingsFormat extends PostingsFormat {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public FieldsProducer fieldsProducer(SegmentReadState state)
|
public final FieldsProducer fieldsProducer(SegmentReadState state)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
return new FieldsReader(state);
|
return new FieldsReader(state);
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,22 +25,9 @@ import java.util.List;
|
||||||
|
|
||||||
import org.apache.lucene.analysis.MockAnalyzer;
|
import org.apache.lucene.analysis.MockAnalyzer;
|
||||||
import org.apache.lucene.codecs.Codec;
|
import org.apache.lucene.codecs.Codec;
|
||||||
import org.apache.lucene.codecs.DocValuesFormat;
|
import org.apache.lucene.codecs.FilterCodec;
|
||||||
import org.apache.lucene.codecs.FieldInfosFormat;
|
|
||||||
import org.apache.lucene.codecs.LiveDocsFormat;
|
|
||||||
import org.apache.lucene.codecs.NormsFormat;
|
|
||||||
import org.apache.lucene.codecs.PostingsFormat;
|
import org.apache.lucene.codecs.PostingsFormat;
|
||||||
import org.apache.lucene.codecs.SegmentInfoFormat;
|
|
||||||
import org.apache.lucene.codecs.StoredFieldsFormat;
|
|
||||||
import org.apache.lucene.codecs.TermVectorsFormat;
|
|
||||||
import org.apache.lucene.codecs.lucene40.Lucene40Codec;
|
import org.apache.lucene.codecs.lucene40.Lucene40Codec;
|
||||||
import org.apache.lucene.codecs.lucene40.Lucene40DocValuesFormat;
|
|
||||||
import org.apache.lucene.codecs.lucene40.Lucene40FieldInfosFormat;
|
|
||||||
import org.apache.lucene.codecs.lucene40.Lucene40LiveDocsFormat;
|
|
||||||
import org.apache.lucene.codecs.lucene40.Lucene40NormsFormat;
|
|
||||||
import org.apache.lucene.codecs.lucene40.Lucene40SegmentInfoFormat;
|
|
||||||
import org.apache.lucene.codecs.lucene40.Lucene40StoredFieldsFormat;
|
|
||||||
import org.apache.lucene.codecs.lucene40.Lucene40TermVectorsFormat;
|
|
||||||
import org.apache.lucene.codecs.pulsing.Pulsing40PostingsFormat;
|
import org.apache.lucene.codecs.pulsing.Pulsing40PostingsFormat;
|
||||||
import org.apache.lucene.document.Document;
|
import org.apache.lucene.document.Document;
|
||||||
import org.apache.lucene.document.Field;
|
import org.apache.lucene.document.Field;
|
||||||
|
@ -1120,49 +1107,14 @@ public class TestAddIndexes extends LuceneTestCase {
|
||||||
dir.close();
|
dir.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class UnRegisteredCodec extends Codec {
|
private static final class UnRegisteredCodec extends FilterCodec {
|
||||||
public UnRegisteredCodec() {
|
public UnRegisteredCodec() {
|
||||||
super("NotRegistered");
|
super("NotRegistered");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PostingsFormat postingsFormat() {
|
protected Codec delegate() {
|
||||||
return PostingsFormat.forName("Lucene40");
|
return Codec.forName("Lucene40");
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public DocValuesFormat docValuesFormat() {
|
|
||||||
return new Lucene40DocValuesFormat();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public StoredFieldsFormat storedFieldsFormat() {
|
|
||||||
return new Lucene40StoredFieldsFormat();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public TermVectorsFormat termVectorsFormat() {
|
|
||||||
return new Lucene40TermVectorsFormat();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public FieldInfosFormat fieldInfosFormat() {
|
|
||||||
return new Lucene40FieldInfosFormat();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public SegmentInfoFormat segmentInfoFormat() {
|
|
||||||
return new Lucene40SegmentInfoFormat();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public NormsFormat normsFormat() {
|
|
||||||
return new Lucene40NormsFormat();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public LiveDocsFormat liveDocsFormat() {
|
|
||||||
return new Lucene40LiveDocsFormat();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,77 +18,36 @@ package org.apache.lucene.codecs.asserting;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import org.apache.lucene.codecs.Codec;
|
import org.apache.lucene.codecs.Codec;
|
||||||
import org.apache.lucene.codecs.DocValuesFormat;
|
import org.apache.lucene.codecs.FilterCodec;
|
||||||
import org.apache.lucene.codecs.FieldInfosFormat;
|
|
||||||
import org.apache.lucene.codecs.LiveDocsFormat;
|
|
||||||
import org.apache.lucene.codecs.NormsFormat;
|
|
||||||
import org.apache.lucene.codecs.PostingsFormat;
|
import org.apache.lucene.codecs.PostingsFormat;
|
||||||
import org.apache.lucene.codecs.SegmentInfoFormat;
|
|
||||||
import org.apache.lucene.codecs.StoredFieldsFormat;
|
|
||||||
import org.apache.lucene.codecs.TermVectorsFormat;
|
import org.apache.lucene.codecs.TermVectorsFormat;
|
||||||
import org.apache.lucene.codecs.lucene40.Lucene40Codec; // javadocs @link
|
import org.apache.lucene.codecs.lucene40.Lucene40Codec;
|
||||||
import org.apache.lucene.codecs.lucene40.Lucene40DocValuesFormat;
|
|
||||||
import org.apache.lucene.codecs.lucene40.Lucene40FieldInfosFormat;
|
|
||||||
import org.apache.lucene.codecs.lucene40.Lucene40LiveDocsFormat;
|
|
||||||
import org.apache.lucene.codecs.lucene40.Lucene40NormsFormat;
|
|
||||||
import org.apache.lucene.codecs.lucene40.Lucene40SegmentInfoFormat;
|
|
||||||
import org.apache.lucene.codecs.lucene40.Lucene40StoredFieldsFormat;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Acts like {@link Lucene40Codec} but with additional asserts.
|
* Acts like {@link Lucene40Codec} but with additional asserts.
|
||||||
*/
|
*/
|
||||||
public class AssertingCodec extends Codec {
|
public final class AssertingCodec extends FilterCodec {
|
||||||
|
|
||||||
private final PostingsFormat postings = new AssertingPostingsFormat();
|
private final PostingsFormat postings = new AssertingPostingsFormat();
|
||||||
private final SegmentInfoFormat infos = new Lucene40SegmentInfoFormat();
|
|
||||||
private final StoredFieldsFormat fields = new Lucene40StoredFieldsFormat();
|
|
||||||
private final FieldInfosFormat fieldInfos = new Lucene40FieldInfosFormat();
|
|
||||||
private final TermVectorsFormat vectors = new AssertingTermVectorsFormat();
|
private final TermVectorsFormat vectors = new AssertingTermVectorsFormat();
|
||||||
private final DocValuesFormat docValues = new Lucene40DocValuesFormat();
|
|
||||||
private final NormsFormat norms = new Lucene40NormsFormat();
|
|
||||||
private final LiveDocsFormat liveDocs = new Lucene40LiveDocsFormat();
|
|
||||||
|
|
||||||
public AssertingCodec() {
|
public AssertingCodec() {
|
||||||
super("Asserting");
|
super("Asserting");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Codec delegate() {
|
||||||
|
return Codec.forName("Lucene40");
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PostingsFormat postingsFormat() {
|
public PostingsFormat postingsFormat() {
|
||||||
return postings;
|
return postings;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public DocValuesFormat docValuesFormat() {
|
|
||||||
return docValues;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public StoredFieldsFormat storedFieldsFormat() {
|
|
||||||
return fields;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TermVectorsFormat termVectorsFormat() {
|
public TermVectorsFormat termVectorsFormat() {
|
||||||
return vectors;
|
return vectors;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public FieldInfosFormat fieldInfosFormat() {
|
|
||||||
return fieldInfos;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public SegmentInfoFormat segmentInfoFormat() {
|
|
||||||
return infos;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public NormsFormat normsFormat() {
|
|
||||||
return norms;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public LiveDocsFormat liveDocsFormat() {
|
|
||||||
return liveDocs;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,7 +40,7 @@ import org.apache.lucene.util.OpenBitSet;
|
||||||
/**
|
/**
|
||||||
* Just like {@link Lucene40PostingsFormat} but with additional asserts.
|
* Just like {@link Lucene40PostingsFormat} but with additional asserts.
|
||||||
*/
|
*/
|
||||||
public class AssertingPostingsFormat extends PostingsFormat {
|
public final class AssertingPostingsFormat extends PostingsFormat {
|
||||||
private final PostingsFormat in = new Lucene40PostingsFormat();
|
private final PostingsFormat in = new Lucene40PostingsFormat();
|
||||||
|
|
||||||
public AssertingPostingsFormat() {
|
public AssertingPostingsFormat() {
|
||||||
|
|
|
@ -34,7 +34,7 @@ import org.apache.lucene.index.SegmentWriteState;
|
||||||
* APPLICATION This is not a realistic application of Bloom Filters as they
|
* APPLICATION This is not a realistic application of Bloom Filters as they
|
||||||
* ordinarily are larger and operate on only primary key type fields.
|
* ordinarily are larger and operate on only primary key type fields.
|
||||||
*/
|
*/
|
||||||
public class TestBloomFilteredLucene40Postings extends PostingsFormat {
|
public final class TestBloomFilteredLucene40Postings extends PostingsFormat {
|
||||||
|
|
||||||
private BloomFilteringPostingsFormat delegate;
|
private BloomFilteringPostingsFormat delegate;
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,7 @@ import org.apache.lucene.util.BytesRef;
|
||||||
* Customized version of {@link Lucene40Codec} that uses
|
* Customized version of {@link Lucene40Codec} that uses
|
||||||
* {@link FixedGapTermsIndexWriter}.
|
* {@link FixedGapTermsIndexWriter}.
|
||||||
*/
|
*/
|
||||||
public class Lucene40WithOrds extends PostingsFormat {
|
public final class Lucene40WithOrds extends PostingsFormat {
|
||||||
|
|
||||||
public Lucene40WithOrds() {
|
public Lucene40WithOrds() {
|
||||||
super("Lucene40WithOrds");
|
super("Lucene40WithOrds");
|
||||||
|
|
|
@ -49,7 +49,7 @@ import org.apache.lucene.util.IOUtils;
|
||||||
* used here just writes each block as a series of vInt.
|
* used here just writes each block as a series of vInt.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class MockFixedIntBlockPostingsFormat extends PostingsFormat {
|
public final class MockFixedIntBlockPostingsFormat extends PostingsFormat {
|
||||||
|
|
||||||
private final int blockSize;
|
private final int blockSize;
|
||||||
|
|
||||||
|
|
|
@ -53,7 +53,7 @@ import org.apache.lucene.util.IOUtils;
|
||||||
* int is <= 3, else 2*baseBlockSize.
|
* int is <= 3, else 2*baseBlockSize.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class MockVariableIntBlockPostingsFormat extends PostingsFormat {
|
public final class MockVariableIntBlockPostingsFormat extends PostingsFormat {
|
||||||
private final int baseBlockSize;
|
private final int baseBlockSize;
|
||||||
|
|
||||||
public MockVariableIntBlockPostingsFormat() {
|
public MockVariableIntBlockPostingsFormat() {
|
||||||
|
|
|
@ -66,7 +66,7 @@ import org.apache.lucene.util._TestUtil;
|
||||||
* Randomly combines terms index impl w/ postings impls.
|
* Randomly combines terms index impl w/ postings impls.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class MockRandomPostingsFormat extends PostingsFormat {
|
public final class MockRandomPostingsFormat extends PostingsFormat {
|
||||||
private final Random seedRandom;
|
private final Random seedRandom;
|
||||||
private final String SEED_EXT = "sd";
|
private final String SEED_EXT = "sd";
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,7 @@ import org.apache.lucene.util.BytesRef;
|
||||||
* This is here just to test the core sep codec
|
* This is here just to test the core sep codec
|
||||||
* classes.
|
* classes.
|
||||||
*/
|
*/
|
||||||
public class MockSepPostingsFormat extends PostingsFormat {
|
public final class MockSepPostingsFormat extends PostingsFormat {
|
||||||
|
|
||||||
public MockSepPostingsFormat() {
|
public MockSepPostingsFormat() {
|
||||||
super("MockSep");
|
super("MockSep");
|
||||||
|
|
|
@ -41,7 +41,7 @@ import org.apache.lucene.util.IOUtils;
|
||||||
// TODO: if we create PulsingPostingsBaseFormat then we
|
// TODO: if we create PulsingPostingsBaseFormat then we
|
||||||
// can simplify this? note: I don't like the *BaseFormat
|
// can simplify this? note: I don't like the *BaseFormat
|
||||||
// hierarchy, maybe we can clean that up...
|
// hierarchy, maybe we can clean that up...
|
||||||
public class NestedPulsingPostingsFormat extends PostingsFormat {
|
public final class NestedPulsingPostingsFormat extends PostingsFormat {
|
||||||
public NestedPulsingPostingsFormat() {
|
public NestedPulsingPostingsFormat() {
|
||||||
super("NestedPulsing");
|
super("NestedPulsing");
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,7 +57,7 @@ import org.apache.lucene.util.IOUtils;
|
||||||
*
|
*
|
||||||
* NOTE: this codec sorts terms by reverse-unicode-order! */
|
* NOTE: this codec sorts terms by reverse-unicode-order! */
|
||||||
|
|
||||||
public class RAMOnlyPostingsFormat extends PostingsFormat {
|
public final class RAMOnlyPostingsFormat extends PostingsFormat {
|
||||||
|
|
||||||
// For fun, test that we can override how terms are
|
// For fun, test that we can override how terms are
|
||||||
// sorted, and basic things still work -- this comparator
|
// sorted, and basic things still work -- this comparator
|
||||||
|
|
Loading…
Reference in New Issue