mirror of
https://github.com/apache/lucene.git
synced 2025-02-17 15:35:20 +00:00
fix naming
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/branches/lucene4547@1435177 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
3a31933b48
commit
69c6779625
@ -21,7 +21,7 @@ import java.io.IOException;
|
||||
import java.util.Iterator;
|
||||
|
||||
import org.apache.lucene.codecs.CodecUtil;
|
||||
import org.apache.lucene.codecs.SimpleDVConsumer;
|
||||
import org.apache.lucene.codecs.DocValuesConsumer;
|
||||
import org.apache.lucene.index.FieldInfo;
|
||||
import org.apache.lucene.index.IndexFileNames;
|
||||
import org.apache.lucene.index.SegmentWriteState;
|
||||
@ -32,7 +32,7 @@ import org.apache.lucene.util.packed.PackedInts;
|
||||
import org.apache.lucene.util.packed.PackedInts.FormatAndBits;
|
||||
|
||||
// nocommit fix exception handling (make sure tests find problems first)
|
||||
class DiskDocValuesConsumer extends SimpleDVConsumer {
|
||||
class DiskDocValuesConsumer extends DocValuesConsumer {
|
||||
final IndexOutput data, meta;
|
||||
final int maxDoc;
|
||||
|
||||
|
@ -19,9 +19,9 @@ package org.apache.lucene.codecs.diskdv;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.apache.lucene.codecs.SimpleDVConsumer;
|
||||
import org.apache.lucene.codecs.SimpleDVProducer;
|
||||
import org.apache.lucene.codecs.SimpleDocValuesFormat;
|
||||
import org.apache.lucene.codecs.DocValuesConsumer;
|
||||
import org.apache.lucene.codecs.DocValuesProducer;
|
||||
import org.apache.lucene.codecs.DocValuesFormat;
|
||||
import org.apache.lucene.index.SegmentReadState;
|
||||
import org.apache.lucene.index.SegmentWriteState;
|
||||
|
||||
@ -37,19 +37,19 @@ import org.apache.lucene.index.SegmentWriteState;
|
||||
* fixedLength SortedField = BINARY + NUMERIC (ords)
|
||||
* variableLength SortedField = BINARY + NUMERIC (addresses) + NUMERIC (ords)
|
||||
*/
|
||||
public class DiskDocValuesFormat extends SimpleDocValuesFormat {
|
||||
public class DiskDocValuesFormat extends DocValuesFormat {
|
||||
|
||||
public DiskDocValuesFormat() {
|
||||
super("Disk");
|
||||
}
|
||||
|
||||
@Override
|
||||
public SimpleDVConsumer fieldsConsumer(SegmentWriteState state) throws IOException {
|
||||
public DocValuesConsumer fieldsConsumer(SegmentWriteState state) throws IOException {
|
||||
return new DiskDocValuesConsumer(state);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SimpleDVProducer fieldsProducer(SegmentReadState state) throws IOException {
|
||||
public DocValuesProducer fieldsProducer(SegmentReadState state) throws IOException {
|
||||
return new DiskDocValuesProducer(state);
|
||||
}
|
||||
|
||||
|
@ -22,7 +22,7 @@ import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.lucene.codecs.CodecUtil;
|
||||
import org.apache.lucene.codecs.SimpleDVProducer;
|
||||
import org.apache.lucene.codecs.DocValuesProducer;
|
||||
import org.apache.lucene.index.BinaryDocValues;
|
||||
import org.apache.lucene.index.CorruptIndexException;
|
||||
import org.apache.lucene.index.FieldInfo;
|
||||
@ -37,7 +37,7 @@ import org.apache.lucene.util.BytesRef;
|
||||
import org.apache.lucene.util.IOUtils;
|
||||
import org.apache.lucene.util.packed.PackedInts;
|
||||
|
||||
class DiskDocValuesProducer extends SimpleDVProducer {
|
||||
class DiskDocValuesProducer extends DocValuesProducer {
|
||||
private final Map<Integer,NumericEntry> numerics;
|
||||
private final Map<Integer,NumericEntry> ords;
|
||||
private final Map<Integer,BinaryEntry> binaries;
|
||||
|
@ -19,11 +19,11 @@ package org.apache.lucene.codecs.memory;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.apache.lucene.codecs.SimpleDVConsumer;
|
||||
import org.apache.lucene.codecs.SimpleDVProducer;
|
||||
import org.apache.lucene.codecs.SimpleDocValuesFormat;
|
||||
import org.apache.lucene.codecs.simpletext.SimpleTextSimpleDocValuesFormat.SimpleTextDocValuesReader;
|
||||
import org.apache.lucene.codecs.simpletext.SimpleTextSimpleDocValuesFormat.SimpleTextDocValuesWriter;
|
||||
import org.apache.lucene.codecs.DocValuesConsumer;
|
||||
import org.apache.lucene.codecs.DocValuesProducer;
|
||||
import org.apache.lucene.codecs.DocValuesFormat;
|
||||
import org.apache.lucene.codecs.simpletext.SimpleTextDocValuesFormat.SimpleTextDocValuesReader;
|
||||
import org.apache.lucene.codecs.simpletext.SimpleTextDocValuesFormat.SimpleTextDocValuesWriter;
|
||||
import org.apache.lucene.index.BinaryDocValues;
|
||||
import org.apache.lucene.index.FieldInfo;
|
||||
import org.apache.lucene.index.NumericDocValues;
|
||||
@ -37,14 +37,14 @@ import org.apache.lucene.util.packed.PackedInts;
|
||||
* search time. */
|
||||
|
||||
// nocommit: nuke this wrapper and just make a nice impl for 4.1 (e.g. FST for sortedbytes)
|
||||
public class MemoryDocValuesFormat extends SimpleDocValuesFormat {
|
||||
public class MemoryDocValuesFormat extends DocValuesFormat {
|
||||
|
||||
public MemoryDocValuesFormat() {
|
||||
super("Memory");
|
||||
}
|
||||
|
||||
@Override
|
||||
public SimpleDVConsumer fieldsConsumer(SegmentWriteState state) throws IOException {
|
||||
public DocValuesConsumer fieldsConsumer(SegmentWriteState state) throws IOException {
|
||||
// nocommit use a more efficient format ;):
|
||||
return new SimpleTextDocValuesWriter(state, "dat");
|
||||
}
|
||||
@ -53,11 +53,11 @@ public class MemoryDocValuesFormat extends SimpleDocValuesFormat {
|
||||
// per-thread!
|
||||
|
||||
@Override
|
||||
public SimpleDVProducer fieldsProducer(SegmentReadState state) throws IOException {
|
||||
public DocValuesProducer fieldsProducer(SegmentReadState state) throws IOException {
|
||||
final int maxDoc = state.segmentInfo.getDocCount();
|
||||
final SimpleDVProducer producer = new SimpleTextDocValuesReader(state, "dat");
|
||||
final DocValuesProducer producer = new SimpleTextDocValuesReader(state, "dat");
|
||||
|
||||
return new SimpleDVProducer() {
|
||||
return new DocValuesProducer() {
|
||||
|
||||
@Override
|
||||
public NumericDocValues getNumeric(FieldInfo field) throws IOException {
|
||||
|
@ -22,8 +22,8 @@ import org.apache.lucene.codecs.FieldInfosFormat;
|
||||
import org.apache.lucene.codecs.LiveDocsFormat;
|
||||
import org.apache.lucene.codecs.PostingsFormat;
|
||||
import org.apache.lucene.codecs.SegmentInfoFormat;
|
||||
import org.apache.lucene.codecs.SimpleDocValuesFormat;
|
||||
import org.apache.lucene.codecs.SimpleNormsFormat;
|
||||
import org.apache.lucene.codecs.DocValuesFormat;
|
||||
import org.apache.lucene.codecs.NormsFormat;
|
||||
import org.apache.lucene.codecs.StoredFieldsFormat;
|
||||
import org.apache.lucene.codecs.TermVectorsFormat;
|
||||
|
||||
@ -39,11 +39,11 @@ public final class SimpleTextCodec extends Codec {
|
||||
private final SegmentInfoFormat segmentInfos = new SimpleTextSegmentInfoFormat();
|
||||
private final FieldInfosFormat fieldInfosFormat = new SimpleTextFieldInfosFormat();
|
||||
private final TermVectorsFormat vectorsFormat = new SimpleTextTermVectorsFormat();
|
||||
private final SimpleNormsFormat simpleNormsFormat = new SimpleTextSimpleNormsFormat();
|
||||
private final NormsFormat simpleNormsFormat = new SimpleTextNormsFormat();
|
||||
private final LiveDocsFormat liveDocs = new SimpleTextLiveDocsFormat();
|
||||
|
||||
// nocommit rename
|
||||
private final SimpleDocValuesFormat simpleDVFormat = new SimpleTextSimpleDocValuesFormat();
|
||||
private final DocValuesFormat simpleDVFormat = new SimpleTextDocValuesFormat();
|
||||
|
||||
public SimpleTextCodec() {
|
||||
super("SimpleText");
|
||||
@ -75,7 +75,7 @@ public final class SimpleTextCodec extends Codec {
|
||||
}
|
||||
|
||||
@Override
|
||||
public SimpleNormsFormat simpleNormsFormat() {
|
||||
public NormsFormat normsFormat() {
|
||||
return simpleNormsFormat;
|
||||
}
|
||||
|
||||
@ -85,7 +85,7 @@ public final class SimpleTextCodec extends Codec {
|
||||
}
|
||||
|
||||
@Override
|
||||
public SimpleDocValuesFormat simpleDocValuesFormat() {
|
||||
public DocValuesFormat docValuesFormat() {
|
||||
return simpleDVFormat;
|
||||
}
|
||||
}
|
||||
|
@ -29,9 +29,9 @@ import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.lucene.codecs.SimpleDVConsumer;
|
||||
import org.apache.lucene.codecs.SimpleDVProducer;
|
||||
import org.apache.lucene.codecs.SimpleDocValuesFormat;
|
||||
import org.apache.lucene.codecs.DocValuesConsumer;
|
||||
import org.apache.lucene.codecs.DocValuesProducer;
|
||||
import org.apache.lucene.codecs.DocValuesFormat;
|
||||
import org.apache.lucene.index.BinaryDocValues;
|
||||
import org.apache.lucene.index.CorruptIndexException;
|
||||
import org.apache.lucene.index.FieldInfo;
|
||||
@ -54,7 +54,7 @@ import org.apache.lucene.util.StringHelper;
|
||||
* <b><font color="red">FOR RECREATIONAL USE ONLY</font></B>
|
||||
* @lucene.experimental
|
||||
*/
|
||||
public class SimpleTextSimpleDocValuesFormat extends SimpleDocValuesFormat {
|
||||
public class SimpleTextDocValuesFormat extends DocValuesFormat {
|
||||
final static BytesRef END = new BytesRef("END");
|
||||
final static BytesRef FIELD = new BytesRef("field ");
|
||||
// used for numerics
|
||||
@ -68,17 +68,17 @@ public class SimpleTextSimpleDocValuesFormat extends SimpleDocValuesFormat {
|
||||
final static BytesRef NUMVALUES = new BytesRef(" numvalues ");
|
||||
final static BytesRef ORDPATTERN = new BytesRef(" ordpattern ");
|
||||
|
||||
public SimpleTextSimpleDocValuesFormat() {
|
||||
public SimpleTextDocValuesFormat() {
|
||||
super("SimpleText");
|
||||
}
|
||||
|
||||
@Override
|
||||
public SimpleDVConsumer fieldsConsumer(SegmentWriteState state) throws IOException {
|
||||
public DocValuesConsumer fieldsConsumer(SegmentWriteState state) throws IOException {
|
||||
return new SimpleTextDocValuesWriter(state, "dat");
|
||||
}
|
||||
|
||||
@Override
|
||||
public SimpleDVProducer fieldsProducer(SegmentReadState state) throws IOException {
|
||||
public DocValuesProducer fieldsProducer(SegmentReadState state) throws IOException {
|
||||
return new SimpleTextDocValuesReader(state, "dat");
|
||||
}
|
||||
|
||||
@ -136,7 +136,7 @@ public class SimpleTextSimpleDocValuesFormat extends SimpleDocValuesFormat {
|
||||
* and saving the offset/etc for each field.
|
||||
*/
|
||||
// nocommit not public
|
||||
public static class SimpleTextDocValuesWriter extends SimpleDVConsumer {
|
||||
public static class SimpleTextDocValuesWriter extends DocValuesConsumer {
|
||||
final IndexOutput data;
|
||||
final BytesRef scratch = new BytesRef();
|
||||
final int numDocs;
|
||||
@ -381,7 +381,7 @@ public class SimpleTextSimpleDocValuesFormat extends SimpleDocValuesFormat {
|
||||
// "all docs have empty BytesREf"
|
||||
|
||||
// nocommit not public
|
||||
public static class SimpleTextDocValuesReader extends SimpleDVProducer {
|
||||
public static class SimpleTextDocValuesReader extends DocValuesProducer {
|
||||
|
||||
static class OneField {
|
||||
FieldInfo fieldInfo;
|
@ -20,11 +20,11 @@ package org.apache.lucene.codecs.simpletext;
|
||||
import java.io.IOException;
|
||||
import java.util.Comparator;
|
||||
|
||||
import org.apache.lucene.codecs.SimpleDVConsumer;
|
||||
import org.apache.lucene.codecs.SimpleDVProducer;
|
||||
import org.apache.lucene.codecs.SimpleNormsFormat;
|
||||
import org.apache.lucene.codecs.simpletext.SimpleTextSimpleDocValuesFormat.SimpleTextDocValuesReader;
|
||||
import org.apache.lucene.codecs.simpletext.SimpleTextSimpleDocValuesFormat.SimpleTextDocValuesWriter;
|
||||
import org.apache.lucene.codecs.DocValuesConsumer;
|
||||
import org.apache.lucene.codecs.DocValuesProducer;
|
||||
import org.apache.lucene.codecs.NormsFormat;
|
||||
import org.apache.lucene.codecs.simpletext.SimpleTextDocValuesFormat.SimpleTextDocValuesReader;
|
||||
import org.apache.lucene.codecs.simpletext.SimpleTextDocValuesFormat.SimpleTextDocValuesWriter;
|
||||
import org.apache.lucene.index.AtomicReader;
|
||||
import org.apache.lucene.index.FieldInfo;
|
||||
import org.apache.lucene.index.FieldInfos;
|
||||
@ -39,17 +39,17 @@ import org.apache.lucene.util.BytesRef;
|
||||
*
|
||||
* @lucene.experimental
|
||||
*/
|
||||
public class SimpleTextSimpleNormsFormat extends SimpleNormsFormat {
|
||||
public class SimpleTextNormsFormat extends NormsFormat {
|
||||
// nocommit put back to len once we replace current norms format:
|
||||
private static final String NORMS_SEG_EXTENSION = "slen";
|
||||
|
||||
@Override
|
||||
public SimpleDVConsumer normsConsumer(SegmentWriteState state) throws IOException {
|
||||
public DocValuesConsumer normsConsumer(SegmentWriteState state) throws IOException {
|
||||
return new SimpleTextSimpleNormsConsumer(state);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SimpleDVProducer normsProducer(SegmentReadState state) throws IOException {
|
||||
public DocValuesProducer normsProducer(SegmentReadState state) throws IOException {
|
||||
return new SimpleTextSimpleNormsProducer(state);
|
||||
}
|
||||
|
@ -15,4 +15,4 @@
|
||||
|
||||
org.apache.lucene.codecs.diskdv.DiskDocValuesFormat
|
||||
org.apache.lucene.codecs.memory.MemoryDocValuesFormat
|
||||
org.apache.lucene.codecs.simpletext.SimpleTextSimpleDocValuesFormat
|
||||
org.apache.lucene.codecs.simpletext.SimpleTextDocValuesFormat
|
@ -66,7 +66,7 @@ public abstract class Codec implements NamedSPILoader.NamedSPI {
|
||||
public abstract PostingsFormat postingsFormat();
|
||||
|
||||
/** Encodes/decodes docvalues */
|
||||
public abstract SimpleDocValuesFormat simpleDocValuesFormat();
|
||||
public abstract DocValuesFormat docValuesFormat();
|
||||
|
||||
/** Encodes/decodes stored fields */
|
||||
public abstract StoredFieldsFormat storedFieldsFormat();
|
||||
@ -81,7 +81,7 @@ public abstract class Codec implements NamedSPILoader.NamedSPI {
|
||||
public abstract SegmentInfoFormat segmentInfoFormat();
|
||||
|
||||
/** Encodes/decodes document normalization values */
|
||||
public abstract SimpleNormsFormat simpleNormsFormat();
|
||||
public abstract NormsFormat normsFormat();
|
||||
|
||||
/** Encodes/decodes live docs */
|
||||
public abstract LiveDocsFormat liveDocsFormat();
|
||||
|
@ -36,7 +36,7 @@ import org.apache.lucene.util.FixedBitSet;
|
||||
import org.apache.lucene.util.PriorityQueue;
|
||||
|
||||
// prototype streaming DV api
|
||||
public abstract class SimpleDVConsumer implements Closeable {
|
||||
public abstract class DocValuesConsumer implements Closeable {
|
||||
// TODO: are any of these params too "infringing" on codec?
|
||||
// we want codec to get necessary stuff from IW, but trading off against merge complexity.
|
||||
|
@ -24,10 +24,10 @@ import org.apache.lucene.index.SegmentReadState;
|
||||
import org.apache.lucene.index.SegmentWriteState;
|
||||
import org.apache.lucene.util.NamedSPILoader;
|
||||
|
||||
public abstract class SimpleDocValuesFormat implements NamedSPILoader.NamedSPI {
|
||||
public abstract class DocValuesFormat implements NamedSPILoader.NamedSPI {
|
||||
|
||||
private static final NamedSPILoader<SimpleDocValuesFormat> loader =
|
||||
new NamedSPILoader<SimpleDocValuesFormat>(SimpleDocValuesFormat.class);
|
||||
private static final NamedSPILoader<DocValuesFormat> loader =
|
||||
new NamedSPILoader<DocValuesFormat>(DocValuesFormat.class);
|
||||
|
||||
/** Unique name that's used to retrieve this format when
|
||||
* reading the index.
|
||||
@ -43,14 +43,14 @@ public abstract class SimpleDocValuesFormat implements NamedSPILoader.NamedSPI {
|
||||
* SPI mechanism (registered in META-INF/ of your jar file, etc).
|
||||
* @param name must be all ascii alphanumeric, and less than 128 characters in length.
|
||||
*/
|
||||
protected SimpleDocValuesFormat(String name) {
|
||||
protected DocValuesFormat(String name) {
|
||||
NamedSPILoader.checkServiceName(name);
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public abstract SimpleDVConsumer fieldsConsumer(SegmentWriteState state) throws IOException;
|
||||
public abstract DocValuesConsumer fieldsConsumer(SegmentWriteState state) throws IOException;
|
||||
|
||||
public abstract SimpleDVProducer fieldsProducer(SegmentReadState state) throws IOException;
|
||||
public abstract DocValuesProducer fieldsProducer(SegmentReadState state) throws IOException;
|
||||
|
||||
@Override
|
||||
public final String getName() {
|
||||
@ -63,7 +63,7 @@ public abstract class SimpleDocValuesFormat implements NamedSPILoader.NamedSPI {
|
||||
}
|
||||
|
||||
/** looks up a format by name */
|
||||
public static SimpleDocValuesFormat forName(String name) {
|
||||
public static DocValuesFormat forName(String name) {
|
||||
if (loader == null) {
|
||||
throw new IllegalStateException("You called DocValuesFormat.forName() before all formats could be initialized. "+
|
||||
"This likely happens if you call it from a DocValuesFormat's ctor.");
|
@ -30,7 +30,7 @@ import org.apache.lucene.index.SortedDocValues;
|
||||
// an IW that deletes a commit will cause an SR to hit
|
||||
// exceptions....
|
||||
|
||||
public abstract class SimpleDVProducer implements Closeable {
|
||||
public abstract class DocValuesProducer implements Closeable {
|
||||
|
||||
public abstract NumericDocValues getNumeric(FieldInfo field) throws IOException;
|
||||
|
@ -60,8 +60,8 @@ public abstract class FilterCodec extends Codec {
|
||||
}
|
||||
|
||||
@Override
|
||||
public SimpleDocValuesFormat simpleDocValuesFormat() {
|
||||
return delegate.simpleDocValuesFormat();
|
||||
public DocValuesFormat docValuesFormat() {
|
||||
return delegate.docValuesFormat();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -75,8 +75,8 @@ public abstract class FilterCodec extends Codec {
|
||||
}
|
||||
|
||||
@Override
|
||||
public SimpleNormsFormat simpleNormsFormat() {
|
||||
return delegate.simpleNormsFormat();
|
||||
public NormsFormat normsFormat() {
|
||||
return delegate.normsFormat();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -25,17 +25,17 @@ import org.apache.lucene.index.SegmentWriteState;
|
||||
/**
|
||||
* format for normalization factors
|
||||
*/
|
||||
public abstract class SimpleNormsFormat {
|
||||
public abstract class NormsFormat {
|
||||
/** Sole constructor. (For invocation by subclass
|
||||
* constructors, typically implicit.) */
|
||||
protected SimpleNormsFormat() {
|
||||
protected NormsFormat() {
|
||||
}
|
||||
|
||||
/** Returns a {@link SimpleDVConsumer} to write norms to the
|
||||
/** Returns a {@link DocValuesConsumer} to write norms to the
|
||||
* index. */
|
||||
public abstract SimpleDVConsumer normsConsumer(SegmentWriteState state) throws IOException;
|
||||
public abstract DocValuesConsumer normsConsumer(SegmentWriteState state) throws IOException;
|
||||
|
||||
/** Returns a {@link SimpleDVProducer} to read norms from the
|
||||
/** Returns a {@link DocValuesProducer} to read norms from the
|
||||
* index. */
|
||||
public abstract SimpleDVProducer normsProducer(SegmentReadState state) throws IOException;
|
||||
public abstract DocValuesProducer normsProducer(SegmentReadState state) throws IOException;
|
||||
}
|
@ -23,8 +23,8 @@ import org.apache.lucene.codecs.FilterCodec;
|
||||
import org.apache.lucene.codecs.LiveDocsFormat;
|
||||
import org.apache.lucene.codecs.PostingsFormat;
|
||||
import org.apache.lucene.codecs.SegmentInfoFormat;
|
||||
import org.apache.lucene.codecs.SimpleDocValuesFormat;
|
||||
import org.apache.lucene.codecs.SimpleNormsFormat;
|
||||
import org.apache.lucene.codecs.DocValuesFormat;
|
||||
import org.apache.lucene.codecs.NormsFormat;
|
||||
import org.apache.lucene.codecs.StoredFieldsFormat;
|
||||
import org.apache.lucene.codecs.TermVectorsFormat;
|
||||
import org.apache.lucene.codecs.lucene41.Lucene41SimpleNormsFormat;
|
||||
@ -88,19 +88,19 @@ public final class Lucene40Codec extends Codec {
|
||||
}
|
||||
|
||||
// nocommit need a read-only Lucene40SimpleDVFormat
|
||||
private final SimpleDocValuesFormat defaultDVFormat = SimpleDocValuesFormat.forName("Disk");
|
||||
private final DocValuesFormat defaultDVFormat = DocValuesFormat.forName("Disk");
|
||||
|
||||
@Override
|
||||
public SimpleDocValuesFormat simpleDocValuesFormat() {
|
||||
public DocValuesFormat docValuesFormat() {
|
||||
// nocommit
|
||||
return defaultDVFormat;
|
||||
}
|
||||
|
||||
// nocommit need a read-only Lucene40SimpleNormsFormat:
|
||||
private final SimpleNormsFormat simpleNormsFormat = new Lucene41SimpleNormsFormat();
|
||||
private final NormsFormat simpleNormsFormat = new Lucene41SimpleNormsFormat();
|
||||
|
||||
@Override
|
||||
public SimpleNormsFormat simpleNormsFormat() {
|
||||
public NormsFormat normsFormat() {
|
||||
return simpleNormsFormat;
|
||||
}
|
||||
|
||||
|
@ -23,8 +23,8 @@ import org.apache.lucene.codecs.FilterCodec;
|
||||
import org.apache.lucene.codecs.LiveDocsFormat;
|
||||
import org.apache.lucene.codecs.PostingsFormat;
|
||||
import org.apache.lucene.codecs.SegmentInfoFormat;
|
||||
import org.apache.lucene.codecs.SimpleDocValuesFormat;
|
||||
import org.apache.lucene.codecs.SimpleNormsFormat;
|
||||
import org.apache.lucene.codecs.DocValuesFormat;
|
||||
import org.apache.lucene.codecs.NormsFormat;
|
||||
import org.apache.lucene.codecs.StoredFieldsFormat;
|
||||
import org.apache.lucene.codecs.TermVectorsFormat;
|
||||
import org.apache.lucene.codecs.lucene40.Lucene40FieldInfosFormat;
|
||||
@ -61,9 +61,9 @@ public class Lucene41Codec extends Codec {
|
||||
};
|
||||
|
||||
|
||||
private final SimpleDocValuesFormat simpleDocValuesFormat = new PerFieldDocValuesFormat() {
|
||||
private final DocValuesFormat simpleDocValuesFormat = new PerFieldDocValuesFormat() {
|
||||
@Override
|
||||
public SimpleDocValuesFormat getDocValuesFormatForField(String field) {
|
||||
public DocValuesFormat getDocValuesFormatForField(String field) {
|
||||
return Lucene41Codec.this.getDocValuesFormatForField(field);
|
||||
}
|
||||
};
|
||||
@ -117,23 +117,23 @@ public class Lucene41Codec extends Codec {
|
||||
*
|
||||
* The default implementation always returns "Lucene41"
|
||||
*/
|
||||
public SimpleDocValuesFormat getDocValuesFormatForField(String field) {
|
||||
public DocValuesFormat getDocValuesFormatForField(String field) {
|
||||
return defaultDVFormat;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SimpleDocValuesFormat simpleDocValuesFormat() {
|
||||
public DocValuesFormat docValuesFormat() {
|
||||
return simpleDocValuesFormat;
|
||||
}
|
||||
|
||||
private final PostingsFormat defaultFormat = PostingsFormat.forName("Lucene41");
|
||||
// nocommit
|
||||
private final SimpleDocValuesFormat defaultDVFormat = SimpleDocValuesFormat.forName("Lucene41");
|
||||
private final DocValuesFormat defaultDVFormat = DocValuesFormat.forName("Lucene41");
|
||||
|
||||
private final SimpleNormsFormat simpleNormsFormat = new Lucene41SimpleNormsFormat();
|
||||
private final NormsFormat simpleNormsFormat = new Lucene41SimpleNormsFormat();
|
||||
|
||||
@Override
|
||||
public SimpleNormsFormat simpleNormsFormat() {
|
||||
public NormsFormat normsFormat() {
|
||||
return simpleNormsFormat;
|
||||
}
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
|
||||
import org.apache.lucene.codecs.CodecUtil;
|
||||
import org.apache.lucene.codecs.SimpleDVConsumer;
|
||||
import org.apache.lucene.codecs.DocValuesConsumer;
|
||||
import org.apache.lucene.index.FieldInfo;
|
||||
import org.apache.lucene.index.IndexFileNames;
|
||||
import org.apache.lucene.index.SegmentWriteState;
|
||||
@ -47,7 +47,7 @@ import org.apache.lucene.util.packed.PackedInts.FormatAndBits;
|
||||
* the latter is typically much smaller with lucene's sims, as only some byte values are used,
|
||||
* but its often a nonlinear mapping, especially if you dont use crazy boosts.
|
||||
*/
|
||||
class Lucene41SimpleDocValuesConsumer extends SimpleDVConsumer {
|
||||
class Lucene41SimpleDocValuesConsumer extends DocValuesConsumer {
|
||||
static final int VERSION_START = 0;
|
||||
static final int VERSION_CURRENT = VERSION_START;
|
||||
|
||||
|
@ -19,25 +19,25 @@ package org.apache.lucene.codecs.lucene41;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.apache.lucene.codecs.SimpleDVConsumer;
|
||||
import org.apache.lucene.codecs.SimpleDVProducer;
|
||||
import org.apache.lucene.codecs.SimpleDocValuesFormat;
|
||||
import org.apache.lucene.codecs.DocValuesConsumer;
|
||||
import org.apache.lucene.codecs.DocValuesProducer;
|
||||
import org.apache.lucene.codecs.DocValuesFormat;
|
||||
import org.apache.lucene.index.SegmentReadState;
|
||||
import org.apache.lucene.index.SegmentWriteState;
|
||||
|
||||
public class Lucene41SimpleDocValuesFormat extends SimpleDocValuesFormat {
|
||||
public class Lucene41SimpleDocValuesFormat extends DocValuesFormat {
|
||||
|
||||
public Lucene41SimpleDocValuesFormat() {
|
||||
super("Lucene41");
|
||||
}
|
||||
|
||||
@Override
|
||||
public SimpleDVConsumer fieldsConsumer(SegmentWriteState state) throws IOException {
|
||||
public DocValuesConsumer fieldsConsumer(SegmentWriteState state) throws IOException {
|
||||
return new Lucene41SimpleDocValuesConsumer(state, DATA_CODEC, DATA_EXTENSION, METADATA_CODEC, METADATA_EXTENSION);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SimpleDVProducer fieldsProducer(SegmentReadState state) throws IOException {
|
||||
public DocValuesProducer fieldsProducer(SegmentReadState state) throws IOException {
|
||||
return new Lucene41SimpleDocValuesProducer(state, DATA_CODEC, DATA_EXTENSION, METADATA_CODEC, METADATA_EXTENSION);
|
||||
}
|
||||
|
||||
|
@ -22,7 +22,7 @@ import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.lucene.codecs.CodecUtil;
|
||||
import org.apache.lucene.codecs.SimpleDVProducer;
|
||||
import org.apache.lucene.codecs.DocValuesProducer;
|
||||
import org.apache.lucene.index.BinaryDocValues;
|
||||
import org.apache.lucene.index.CorruptIndexException;
|
||||
import org.apache.lucene.index.FieldInfo;
|
||||
@ -45,7 +45,7 @@ import org.apache.lucene.util.fst.PositiveIntOutputs;
|
||||
import org.apache.lucene.util.fst.Util;
|
||||
import org.apache.lucene.util.packed.PackedInts;
|
||||
|
||||
class Lucene41SimpleDocValuesProducer extends SimpleDVProducer {
|
||||
class Lucene41SimpleDocValuesProducer extends DocValuesProducer {
|
||||
// metadata maps (just file pointers and minimal stuff)
|
||||
private final Map<Integer,NumericEntry> numerics;
|
||||
private final Map<Integer,BinaryEntry> binaries;
|
||||
|
@ -19,21 +19,21 @@ package org.apache.lucene.codecs.lucene41;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.apache.lucene.codecs.SimpleDVConsumer;
|
||||
import org.apache.lucene.codecs.SimpleDVProducer;
|
||||
import org.apache.lucene.codecs.SimpleNormsFormat;
|
||||
import org.apache.lucene.codecs.DocValuesConsumer;
|
||||
import org.apache.lucene.codecs.DocValuesProducer;
|
||||
import org.apache.lucene.codecs.NormsFormat;
|
||||
import org.apache.lucene.index.SegmentReadState;
|
||||
import org.apache.lucene.index.SegmentWriteState;
|
||||
|
||||
public class Lucene41SimpleNormsFormat extends SimpleNormsFormat {
|
||||
public class Lucene41SimpleNormsFormat extends NormsFormat {
|
||||
|
||||
@Override
|
||||
public SimpleDVConsumer normsConsumer(SegmentWriteState state) throws IOException {
|
||||
public DocValuesConsumer normsConsumer(SegmentWriteState state) throws IOException {
|
||||
return new Lucene41SimpleDocValuesConsumer(state, DATA_CODEC, DATA_EXTENSION, METADATA_CODEC, METADATA_EXTENSION);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SimpleDVProducer normsProducer(SegmentReadState state) throws IOException {
|
||||
public DocValuesProducer normsProducer(SegmentReadState state) throws IOException {
|
||||
return new Lucene41SimpleDocValuesProducer(state, DATA_CODEC, DATA_EXTENSION, METADATA_CODEC, METADATA_EXTENSION);
|
||||
}
|
||||
|
||||
|
@ -26,9 +26,9 @@ import java.util.ServiceLoader; // javadocs
|
||||
import java.util.TreeMap;
|
||||
|
||||
import org.apache.lucene.codecs.PostingsFormat;
|
||||
import org.apache.lucene.codecs.SimpleDVConsumer;
|
||||
import org.apache.lucene.codecs.SimpleDVProducer;
|
||||
import org.apache.lucene.codecs.SimpleDocValuesFormat;
|
||||
import org.apache.lucene.codecs.DocValuesConsumer;
|
||||
import org.apache.lucene.codecs.DocValuesProducer;
|
||||
import org.apache.lucene.codecs.DocValuesFormat;
|
||||
import org.apache.lucene.index.BinaryDocValues;
|
||||
import org.apache.lucene.index.FieldInfo;
|
||||
import org.apache.lucene.index.NumericDocValues;
|
||||
@ -54,7 +54,7 @@ import org.apache.lucene.util.IOUtils;
|
||||
* @lucene.experimental
|
||||
*/
|
||||
|
||||
public abstract class PerFieldDocValuesFormat extends SimpleDocValuesFormat {
|
||||
public abstract class PerFieldDocValuesFormat extends DocValuesFormat {
|
||||
/** Name of this {@link PostingsFormat}. */
|
||||
public static final String PER_FIELD_NAME = "PerFieldDV40";
|
||||
|
||||
@ -73,13 +73,13 @@ public abstract class PerFieldDocValuesFormat extends SimpleDocValuesFormat {
|
||||
}
|
||||
|
||||
@Override
|
||||
public final SimpleDVConsumer fieldsConsumer(SegmentWriteState state)
|
||||
public final DocValuesConsumer fieldsConsumer(SegmentWriteState state)
|
||||
throws IOException {
|
||||
return new FieldsWriter(state);
|
||||
}
|
||||
|
||||
static class SimpleDVConsumerAndSuffix implements Closeable {
|
||||
SimpleDVConsumer consumer;
|
||||
DocValuesConsumer consumer;
|
||||
int suffix;
|
||||
|
||||
@Override
|
||||
@ -88,9 +88,9 @@ public abstract class PerFieldDocValuesFormat extends SimpleDocValuesFormat {
|
||||
}
|
||||
}
|
||||
|
||||
private class FieldsWriter extends SimpleDVConsumer {
|
||||
private class FieldsWriter extends DocValuesConsumer {
|
||||
|
||||
private final Map<SimpleDocValuesFormat,SimpleDVConsumerAndSuffix> formats = new HashMap<SimpleDocValuesFormat,SimpleDVConsumerAndSuffix>();
|
||||
private final Map<DocValuesFormat,SimpleDVConsumerAndSuffix> formats = new HashMap<DocValuesFormat,SimpleDVConsumerAndSuffix>();
|
||||
private final Map<String,Integer> suffixes = new HashMap<String,Integer>();
|
||||
|
||||
private final SegmentWriteState segmentWriteState;
|
||||
@ -114,8 +114,8 @@ public abstract class PerFieldDocValuesFormat extends SimpleDocValuesFormat {
|
||||
getInstance(field).addSortedField(field, values, docToOrd);
|
||||
}
|
||||
|
||||
private SimpleDVConsumer getInstance(FieldInfo field) throws IOException {
|
||||
final SimpleDocValuesFormat format = getDocValuesFormatForField(field.name);
|
||||
private DocValuesConsumer getInstance(FieldInfo field) throws IOException {
|
||||
final DocValuesFormat format = getDocValuesFormatForField(field.name);
|
||||
if (format == null) {
|
||||
throw new IllegalStateException("invalid null DocValuesFormat for field=\"" + field.name + "\"");
|
||||
}
|
||||
@ -185,10 +185,10 @@ public abstract class PerFieldDocValuesFormat extends SimpleDocValuesFormat {
|
||||
// nocommit what if SimpleNormsFormat wants to use this
|
||||
// ...? we have a "boolean isNorms" issue...? I guess we
|
||||
// just need to make a PerFieldNormsFormat?
|
||||
private class FieldsReader extends SimpleDVProducer {
|
||||
private class FieldsReader extends DocValuesProducer {
|
||||
|
||||
private final Map<String,SimpleDVProducer> fields = new TreeMap<String,SimpleDVProducer>();
|
||||
private final Map<String,SimpleDVProducer> formats = new HashMap<String,SimpleDVProducer>();
|
||||
private final Map<String,DocValuesProducer> fields = new TreeMap<String,DocValuesProducer>();
|
||||
private final Map<String,DocValuesProducer> formats = new HashMap<String,DocValuesProducer>();
|
||||
|
||||
public FieldsReader(final SegmentReadState readState) throws IOException {
|
||||
|
||||
@ -204,7 +204,7 @@ public abstract class PerFieldDocValuesFormat extends SimpleDocValuesFormat {
|
||||
// null formatName means the field is in fieldInfos, but has no docvalues!
|
||||
final String suffix = fi.getAttribute(PER_FIELD_SUFFIX_KEY);
|
||||
assert suffix != null;
|
||||
SimpleDocValuesFormat format = SimpleDocValuesFormat.forName(formatName);
|
||||
DocValuesFormat format = DocValuesFormat.forName(formatName);
|
||||
String segmentSuffix = getSuffix(formatName, suffix);
|
||||
if (!formats.containsKey(segmentSuffix)) {
|
||||
formats.put(segmentSuffix, format.fieldsProducer(new SegmentReadState(readState, segmentSuffix)));
|
||||
@ -223,17 +223,17 @@ public abstract class PerFieldDocValuesFormat extends SimpleDocValuesFormat {
|
||||
|
||||
private FieldsReader(FieldsReader other) {
|
||||
|
||||
Map<SimpleDVProducer,SimpleDVProducer> oldToNew = new IdentityHashMap<SimpleDVProducer,SimpleDVProducer>();
|
||||
Map<DocValuesProducer,DocValuesProducer> oldToNew = new IdentityHashMap<DocValuesProducer,DocValuesProducer>();
|
||||
// First clone all formats
|
||||
for(Map.Entry<String,SimpleDVProducer> ent : other.formats.entrySet()) {
|
||||
SimpleDVProducer values = ent.getValue();
|
||||
for(Map.Entry<String,DocValuesProducer> ent : other.formats.entrySet()) {
|
||||
DocValuesProducer values = ent.getValue();
|
||||
formats.put(ent.getKey(), values);
|
||||
oldToNew.put(ent.getValue(), values);
|
||||
}
|
||||
|
||||
// Then rebuild fields:
|
||||
for(Map.Entry<String,SimpleDVProducer> ent : other.fields.entrySet()) {
|
||||
SimpleDVProducer producer = oldToNew.get(ent.getValue());
|
||||
for(Map.Entry<String,DocValuesProducer> ent : other.fields.entrySet()) {
|
||||
DocValuesProducer producer = oldToNew.get(ent.getValue());
|
||||
assert producer != null;
|
||||
fields.put(ent.getKey(), producer);
|
||||
}
|
||||
@ -241,19 +241,19 @@ public abstract class PerFieldDocValuesFormat extends SimpleDocValuesFormat {
|
||||
|
||||
@Override
|
||||
public NumericDocValues getNumeric(FieldInfo field) throws IOException {
|
||||
SimpleDVProducer producer = fields.get(field.name);
|
||||
DocValuesProducer producer = fields.get(field.name);
|
||||
return producer == null ? null : producer.getNumeric(field);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BinaryDocValues getBinary(FieldInfo field) throws IOException {
|
||||
SimpleDVProducer producer = fields.get(field.name);
|
||||
DocValuesProducer producer = fields.get(field.name);
|
||||
return producer == null ? null : producer.getBinary(field);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SortedDocValues getSorted(FieldInfo field) throws IOException {
|
||||
SimpleDVProducer producer = fields.get(field.name);
|
||||
DocValuesProducer producer = fields.get(field.name);
|
||||
return producer == null ? null : producer.getSorted(field);
|
||||
}
|
||||
|
||||
@ -263,13 +263,13 @@ public abstract class PerFieldDocValuesFormat extends SimpleDocValuesFormat {
|
||||
}
|
||||
|
||||
@Override
|
||||
public SimpleDVProducer clone() {
|
||||
public DocValuesProducer clone() {
|
||||
return new FieldsReader(this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public final SimpleDVProducer fieldsProducer(SegmentReadState state) throws IOException {
|
||||
public final DocValuesProducer fieldsProducer(SegmentReadState state) throws IOException {
|
||||
return new FieldsReader(state);
|
||||
}
|
||||
|
||||
@ -279,5 +279,5 @@ public abstract class PerFieldDocValuesFormat extends SimpleDocValuesFormat {
|
||||
* <p>
|
||||
* The field to format mapping is written to the index, so
|
||||
* this method is only invoked when writing, not when reading. */
|
||||
public abstract SimpleDocValuesFormat getDocValuesFormatForField(String field);
|
||||
public abstract DocValuesFormat getDocValuesFormatForField(String field);
|
||||
}
|
||||
|
@ -179,7 +179,7 @@ public abstract class AtomicReader extends IndexReader {
|
||||
/** Returns {@link NumericDocValues} representing norms
|
||||
* for this field, or null if no {@link NumericDocValues}
|
||||
* were indexed. */
|
||||
public abstract NumericDocValues simpleNormValues(String field) throws IOException;
|
||||
public abstract NumericDocValues getNormValues(String field) throws IOException;
|
||||
|
||||
/**
|
||||
* Get the {@link FieldInfos} describing all fields in
|
||||
|
@ -20,7 +20,7 @@ package org.apache.lucene.index;
|
||||
import java.io.IOException;
|
||||
import java.util.Iterator;
|
||||
|
||||
import org.apache.lucene.codecs.SimpleDVConsumer;
|
||||
import org.apache.lucene.codecs.DocValuesConsumer;
|
||||
import org.apache.lucene.util.BytesRef;
|
||||
import org.apache.lucene.util.BytesRefArray;
|
||||
import org.apache.lucene.util.Counter;
|
||||
@ -65,7 +65,7 @@ class BytesDVWriter extends DocValuesWriter {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void flush(SegmentWriteState state, SimpleDVConsumer dvConsumer) throws IOException {
|
||||
public void flush(SegmentWriteState state, DocValuesConsumer dvConsumer) throws IOException {
|
||||
final int maxDoc = state.segmentInfo.getDocCount();
|
||||
|
||||
dvConsumer.addBinaryField(fieldInfo,
|
||||
|
@ -679,7 +679,7 @@ public class CheckIndex {
|
||||
checkSimpleNorms(info, reader, infoStream);
|
||||
++status.totFields;
|
||||
} else {
|
||||
if (reader.simpleNormValues(info.name) != null) {
|
||||
if (reader.getNormValues(info.name) != null) {
|
||||
throw new RuntimeException("field: " + info.name + " should omit norms but has them!");
|
||||
}
|
||||
}
|
||||
@ -1368,7 +1368,7 @@ public class CheckIndex {
|
||||
public static void checkSimpleNorms(FieldInfo fi, AtomicReader reader, PrintStream infoStream) throws IOException {
|
||||
switch(fi.getNormType()) {
|
||||
case NUMERIC:
|
||||
checkNumericDocValues(fi.name, reader, reader.simpleNormValues(fi.name));
|
||||
checkNumericDocValues(fi.name, reader, reader.getNormValues(fi.name));
|
||||
break;
|
||||
default:
|
||||
throw new AssertionError("wtf: " + fi.getNormType());
|
||||
|
@ -21,8 +21,8 @@ import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.lucene.codecs.SimpleDVConsumer;
|
||||
import org.apache.lucene.codecs.SimpleDocValuesFormat;
|
||||
import org.apache.lucene.codecs.DocValuesConsumer;
|
||||
import org.apache.lucene.codecs.DocValuesFormat;
|
||||
import org.apache.lucene.index.FieldInfo.DocValuesType;
|
||||
import org.apache.lucene.util.BytesRef;
|
||||
import org.apache.lucene.util.Counter;
|
||||
@ -77,7 +77,7 @@ final class DocValuesProcessor extends StoredFieldsConsumer {
|
||||
@Override
|
||||
void flush(SegmentWriteState state) throws IOException {
|
||||
if (!writers.isEmpty()) {
|
||||
SimpleDocValuesFormat fmt = state.segmentInfo.getCodec().simpleDocValuesFormat();
|
||||
DocValuesFormat fmt = state.segmentInfo.getCodec().docValuesFormat();
|
||||
// nocommit once we make
|
||||
// Codec.simpleDocValuesFormat abstract, change
|
||||
// this to assert fmt != null!
|
||||
@ -85,7 +85,7 @@ final class DocValuesProcessor extends StoredFieldsConsumer {
|
||||
return;
|
||||
}
|
||||
|
||||
SimpleDVConsumer dvConsumer = fmt.fieldsConsumer(state);
|
||||
DocValuesConsumer dvConsumer = fmt.fieldsConsumer(state);
|
||||
// nocommit change to assert != null:
|
||||
if (dvConsumer == null) {
|
||||
return;
|
||||
|
@ -19,10 +19,10 @@ package org.apache.lucene.index;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.apache.lucene.codecs.SimpleDVConsumer;
|
||||
import org.apache.lucene.codecs.DocValuesConsumer;
|
||||
|
||||
abstract class DocValuesWriter {
|
||||
abstract void abort() throws IOException;
|
||||
abstract void finish(int numDoc);
|
||||
abstract void flush(SegmentWriteState state, SimpleDVConsumer consumer) throws IOException;
|
||||
abstract void flush(SegmentWriteState state, DocValuesConsumer consumer) throws IOException;
|
||||
}
|
||||
|
@ -424,8 +424,8 @@ public class FilterAtomicReader extends AtomicReader {
|
||||
}
|
||||
|
||||
@Override
|
||||
public NumericDocValues simpleNormValues(String field) throws IOException {
|
||||
public NumericDocValues getNormValues(String field) throws IOException {
|
||||
ensureOpen();
|
||||
return in.simpleNormValues(field);
|
||||
return in.getNormValues(field);
|
||||
}
|
||||
}
|
||||
|
@ -31,13 +31,13 @@ import org.apache.lucene.util.IOUtils;
|
||||
import org.apache.lucene.util.Version;
|
||||
|
||||
// nocommit move this back to test-framework!!!
|
||||
public class MultiSimpleDocValues {
|
||||
public class MultiDocValues {
|
||||
|
||||
// moved to src/java so SlowWrapper can use it... uggggggh
|
||||
public static NumericDocValues simpleNormValues(final IndexReader r, final String field) throws IOException {
|
||||
public static NumericDocValues getNormValues(final IndexReader r, final String field) throws IOException {
|
||||
final List<AtomicReaderContext> leaves = r.leaves();
|
||||
if (leaves.size() == 1) {
|
||||
return leaves.get(0).reader().simpleNormValues(field);
|
||||
return leaves.get(0).reader().getNormValues(field);
|
||||
}
|
||||
FieldInfo fi = MultiFields.getMergedFieldInfos(r).fieldInfo(field);
|
||||
if (fi == null || fi.hasNorms() == false) {
|
||||
@ -45,7 +45,7 @@ public class MultiSimpleDocValues {
|
||||
}
|
||||
boolean anyReal = false;
|
||||
for(AtomicReaderContext ctx : leaves) {
|
||||
NumericDocValues norms = ctx.reader().simpleNormValues(field);
|
||||
NumericDocValues norms = ctx.reader().getNormValues(field);
|
||||
|
||||
if (norms != null) {
|
||||
anyReal = true;
|
||||
@ -60,7 +60,7 @@ public class MultiSimpleDocValues {
|
||||
int subIndex = ReaderUtil.subIndex(docID, leaves);
|
||||
NumericDocValues norms;
|
||||
try {
|
||||
norms = leaves.get(subIndex).reader().simpleNormValues(field);
|
||||
norms = leaves.get(subIndex).reader().getNormValues(field);
|
||||
} catch (IOException ioe) {
|
||||
throw new RuntimeException(ioe);
|
||||
}
|
||||
@ -73,7 +73,7 @@ public class MultiSimpleDocValues {
|
||||
};
|
||||
}
|
||||
|
||||
public static NumericDocValues simpleNumericValues(final IndexReader r, final String field) throws IOException {
|
||||
public static NumericDocValues getNumericValues(final IndexReader r, final String field) throws IOException {
|
||||
final List<AtomicReaderContext> leaves = r.leaves();
|
||||
if (leaves.size() == 1) {
|
||||
return leaves.get(0).reader().getNumericDocValues(field);
|
||||
@ -110,7 +110,7 @@ public class MultiSimpleDocValues {
|
||||
}
|
||||
}
|
||||
|
||||
public static BinaryDocValues simpleBinaryValues(final IndexReader r, final String field) throws IOException {
|
||||
public static BinaryDocValues getBinaryValues(final IndexReader r, final String field) throws IOException {
|
||||
final List<AtomicReaderContext> leaves = r.leaves();
|
||||
if (leaves.size() == 1) {
|
||||
return leaves.get(0).reader().getBinaryDocValues(field);
|
||||
@ -150,7 +150,7 @@ public class MultiSimpleDocValues {
|
||||
}
|
||||
}
|
||||
|
||||
public static SortedDocValues simpleSortedValues(final IndexReader r, final String field) throws IOException {
|
||||
public static SortedDocValues getSortedValues(final IndexReader r, final String field) throws IOException {
|
||||
final List<AtomicReaderContext> leaves = r.leaves();
|
||||
if (leaves.size() == 1) {
|
||||
return leaves.get(0).reader().getSortedDocValues(field);
|
@ -20,8 +20,8 @@ package org.apache.lucene.index;
|
||||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.lucene.codecs.SimpleDVConsumer;
|
||||
import org.apache.lucene.codecs.SimpleNormsFormat;
|
||||
import org.apache.lucene.codecs.DocValuesConsumer;
|
||||
import org.apache.lucene.codecs.NormsFormat;
|
||||
import org.apache.lucene.index.FieldInfo.DocValuesType;
|
||||
import org.apache.lucene.util.IOUtils;
|
||||
|
||||
@ -40,10 +40,10 @@ final class NormsConsumer extends InvertedDocEndConsumer {
|
||||
@Override
|
||||
public void flush(Map<String,InvertedDocEndConsumerPerField> fieldsToFlush, SegmentWriteState state) throws IOException {
|
||||
boolean success = false;
|
||||
SimpleDVConsumer normsConsumer = null;
|
||||
DocValuesConsumer normsConsumer = null;
|
||||
try {
|
||||
if (state.fieldInfos.hasNorms()) {
|
||||
SimpleNormsFormat normsFormat = state.segmentInfo.getCodec().simpleNormsFormat();
|
||||
NormsFormat normsFormat = state.segmentInfo.getCodec().normsFormat();
|
||||
assert normsFormat != null;
|
||||
normsConsumer = normsFormat.normsConsumer(state);
|
||||
|
||||
|
@ -17,7 +17,7 @@ package org.apache.lucene.index;
|
||||
*/
|
||||
import java.io.IOException;
|
||||
|
||||
import org.apache.lucene.codecs.SimpleDVConsumer;
|
||||
import org.apache.lucene.codecs.DocValuesConsumer;
|
||||
import org.apache.lucene.search.similarities.Similarity;
|
||||
|
||||
final class NormsConsumerPerField extends InvertedDocEndConsumerPerField implements Comparable<NormsConsumerPerField> {
|
||||
@ -52,7 +52,7 @@ final class NormsConsumerPerField extends InvertedDocEndConsumerPerField impleme
|
||||
}
|
||||
}
|
||||
|
||||
void flush(SegmentWriteState state, SimpleDVConsumer normsWriter) throws IOException {
|
||||
void flush(SegmentWriteState state, DocValuesConsumer normsWriter) throws IOException {
|
||||
int docCount = state.segmentInfo.getDocCount();
|
||||
if (consumer == null) {
|
||||
return; // null type - not omitted but not written -
|
||||
|
@ -20,7 +20,7 @@ package org.apache.lucene.index;
|
||||
import java.io.IOException;
|
||||
import java.util.Iterator;
|
||||
|
||||
import org.apache.lucene.codecs.SimpleDVConsumer;
|
||||
import org.apache.lucene.codecs.DocValuesConsumer;
|
||||
import org.apache.lucene.util.Counter;
|
||||
import org.apache.lucene.util.packed.AppendingLongBuffer;
|
||||
|
||||
@ -72,7 +72,7 @@ class NumberDVWriter extends DocValuesWriter {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void flush(SegmentWriteState state, SimpleDVConsumer dvConsumer) throws IOException {
|
||||
public void flush(SegmentWriteState state, DocValuesConsumer dvConsumer) throws IOException {
|
||||
|
||||
final int maxDoc = state.segmentInfo.getDocCount();
|
||||
|
||||
|
@ -285,10 +285,10 @@ public final class ParallelAtomicReader extends AtomicReader {
|
||||
}
|
||||
|
||||
@Override
|
||||
public NumericDocValues simpleNormValues(String field) throws IOException {
|
||||
public NumericDocValues getNormValues(String field) throws IOException {
|
||||
ensureOpen();
|
||||
AtomicReader reader = fieldToReader.get(field);
|
||||
NumericDocValues values = reader == null ? null : reader.simpleNormValues(field);
|
||||
NumericDocValues values = reader == null ? null : reader.getNormValues(field);
|
||||
return values;
|
||||
}
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
import org.apache.lucene.codecs.Codec;
|
||||
import org.apache.lucene.codecs.FieldsProducer;
|
||||
import org.apache.lucene.codecs.PostingsFormat;
|
||||
import org.apache.lucene.codecs.SimpleDVProducer;
|
||||
import org.apache.lucene.codecs.DocValuesProducer;
|
||||
import org.apache.lucene.codecs.StoredFieldsReader;
|
||||
import org.apache.lucene.codecs.TermVectorsReader;
|
||||
import org.apache.lucene.index.FieldInfo.DocValuesType;
|
||||
@ -54,8 +54,8 @@ final class SegmentCoreReaders {
|
||||
final FieldInfos fieldInfos;
|
||||
|
||||
final FieldsProducer fields;
|
||||
final SimpleDVProducer simpleDVProducer;
|
||||
final SimpleDVProducer simpleNormsProducer;
|
||||
final DocValuesProducer simpleDVProducer;
|
||||
final DocValuesProducer simpleNormsProducer;
|
||||
|
||||
final int termsIndexDivisor;
|
||||
|
||||
@ -132,9 +132,9 @@ final class SegmentCoreReaders {
|
||||
// TODO: since we don't write any norms file if there are no norms,
|
||||
// kinda jaky to assume the codec handles the case of no norms file at all gracefully?!
|
||||
// nocommit shouldn't need null check:
|
||||
if (codec.simpleDocValuesFormat() != null) {
|
||||
if (codec.docValuesFormat() != null) {
|
||||
if (fieldInfos.hasDocValues()) {
|
||||
simpleDVProducer = codec.simpleDocValuesFormat().fieldsProducer(segmentReadState);
|
||||
simpleDVProducer = codec.docValuesFormat().fieldsProducer(segmentReadState);
|
||||
} else {
|
||||
simpleDVProducer = null;
|
||||
}
|
||||
@ -142,9 +142,9 @@ final class SegmentCoreReaders {
|
||||
simpleDVProducer = null;
|
||||
}
|
||||
// nocommit shouldn't need null check:
|
||||
if (codec.simpleNormsFormat() != null) {
|
||||
if (codec.normsFormat() != null) {
|
||||
if (fieldInfos.hasNorms()) {
|
||||
simpleNormsProducer = codec.simpleNormsFormat().normsProducer(segmentReadState);
|
||||
simpleNormsProducer = codec.normsFormat().normsProducer(segmentReadState);
|
||||
} else {
|
||||
simpleNormsProducer = null;
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ import java.util.Map;
|
||||
import org.apache.lucene.codecs.Codec;
|
||||
import org.apache.lucene.codecs.FieldInfosWriter;
|
||||
import org.apache.lucene.codecs.FieldsConsumer;
|
||||
import org.apache.lucene.codecs.SimpleDVConsumer;
|
||||
import org.apache.lucene.codecs.DocValuesConsumer;
|
||||
import org.apache.lucene.codecs.StoredFieldsWriter;
|
||||
import org.apache.lucene.codecs.TermVectorsWriter;
|
||||
import org.apache.lucene.index.FieldInfo.DocValuesType;
|
||||
@ -164,8 +164,8 @@ final class SegmentMerger {
|
||||
|
||||
private void mergeSimpleDocValues(SegmentWriteState segmentWriteState) throws IOException {
|
||||
|
||||
if (codec.simpleDocValuesFormat() != null) {
|
||||
SimpleDVConsumer consumer = codec.simpleDocValuesFormat().fieldsConsumer(segmentWriteState);
|
||||
if (codec.docValuesFormat() != null) {
|
||||
DocValuesConsumer consumer = codec.docValuesFormat().fieldsConsumer(segmentWriteState);
|
||||
boolean success = false;
|
||||
try {
|
||||
for (FieldInfo field : mergeState.fieldInfos) {
|
||||
@ -218,15 +218,15 @@ final class SegmentMerger {
|
||||
}
|
||||
|
||||
private void mergeSimpleNorms(SegmentWriteState segmentWriteState) throws IOException {
|
||||
if (codec.simpleNormsFormat() != null) {
|
||||
SimpleDVConsumer consumer = codec.simpleNormsFormat().normsConsumer(segmentWriteState);
|
||||
if (codec.normsFormat() != null) {
|
||||
DocValuesConsumer consumer = codec.normsFormat().normsConsumer(segmentWriteState);
|
||||
boolean success = false;
|
||||
try {
|
||||
for (FieldInfo field : mergeState.fieldInfos) {
|
||||
if (field.hasNorms()) {
|
||||
List<NumericDocValues> toMerge = new ArrayList<NumericDocValues>();
|
||||
for (AtomicReader reader : mergeState.readers) {
|
||||
NumericDocValues norms = reader.simpleNormValues(field.name);
|
||||
NumericDocValues norms = reader.getNormValues(field.name);
|
||||
if (norms == null) {
|
||||
norms = NumericDocValues.EMPTY;
|
||||
}
|
||||
|
@ -248,7 +248,7 @@ public final class SegmentReader extends AtomicReader {
|
||||
}
|
||||
|
||||
@Override
|
||||
public NumericDocValues simpleNormValues(String field) throws IOException {
|
||||
public NumericDocValues getNormValues(String field) throws IOException {
|
||||
ensureOpen();
|
||||
return core.getSimpleNormValues(field);
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ import org.apache.lucene.index.MultiReader; // javadoc
|
||||
* MultiReader} or {@link DirectoryReader}) to emulate an
|
||||
* atomic reader. This requires implementing the postings
|
||||
* APIs on-the-fly, using the static methods in {@link
|
||||
* MultiFields}, {@link MultiSimpleDocValues}, by stepping through
|
||||
* MultiFields}, {@link MultiDocValues}, by stepping through
|
||||
* the sub-readers to merge fields/terms, appending docs, etc.
|
||||
*
|
||||
* <p><b>NOTE</b>: this class almost always results in a
|
||||
@ -82,26 +82,26 @@ public final class SlowCompositeReaderWrapper extends AtomicReader {
|
||||
@Override
|
||||
public NumericDocValues getNumericDocValues(String field) throws IOException {
|
||||
ensureOpen();
|
||||
return MultiSimpleDocValues.simpleNumericValues(in, field);
|
||||
return MultiDocValues.getNumericValues(in, field);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BinaryDocValues getBinaryDocValues(String field) throws IOException {
|
||||
ensureOpen();
|
||||
return MultiSimpleDocValues.simpleBinaryValues(in, field);
|
||||
return MultiDocValues.getBinaryValues(in, field);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SortedDocValues getSortedDocValues(String field) throws IOException {
|
||||
ensureOpen();
|
||||
return MultiSimpleDocValues.simpleSortedValues(in, field);
|
||||
return MultiDocValues.getSortedValues(in, field);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NumericDocValues simpleNormValues(String field) throws IOException {
|
||||
public NumericDocValues getNormValues(String field) throws IOException {
|
||||
ensureOpen();
|
||||
// nocommit hmm
|
||||
return MultiSimpleDocValues.simpleNormValues(in, field);
|
||||
return MultiDocValues.getNormValues(in, field);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -20,7 +20,7 @@ package org.apache.lucene.index;
|
||||
import java.io.IOException;
|
||||
import java.util.Iterator;
|
||||
|
||||
import org.apache.lucene.codecs.SimpleDVConsumer;
|
||||
import org.apache.lucene.codecs.DocValuesConsumer;
|
||||
import org.apache.lucene.util.ArrayUtil;
|
||||
import org.apache.lucene.util.ByteBlockPool;
|
||||
import org.apache.lucene.util.BytesRef;
|
||||
@ -94,7 +94,7 @@ class SortedBytesDVWriter extends DocValuesWriter {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void flush(SegmentWriteState state, SimpleDVConsumer dvConsumer) throws IOException {
|
||||
public void flush(SegmentWriteState state, DocValuesConsumer dvConsumer) throws IOException {
|
||||
final int maxDoc = state.segmentInfo.getDocCount();
|
||||
|
||||
final int emptyOrd;
|
||||
|
@ -214,7 +214,7 @@ public class BM25Similarity extends Similarity {
|
||||
@Override
|
||||
public final ExactSimScorer exactSimScorer(SimWeight stats, AtomicReaderContext context) throws IOException {
|
||||
BM25Stats bm25stats = (BM25Stats) stats;
|
||||
final NumericDocValues norms = context.reader().simpleNormValues(bm25stats.field);
|
||||
final NumericDocValues norms = context.reader().getNormValues(bm25stats.field);
|
||||
return norms == null
|
||||
? new ExactBM25DocScorerNoNorms(bm25stats)
|
||||
: new ExactBM25DocScorer(bm25stats, norms);
|
||||
@ -223,7 +223,7 @@ public class BM25Similarity extends Similarity {
|
||||
@Override
|
||||
public final SloppySimScorer sloppySimScorer(SimWeight stats, AtomicReaderContext context) throws IOException {
|
||||
BM25Stats bm25stats = (BM25Stats) stats;
|
||||
return new SloppyBM25DocScorer(bm25stats, context.reader().simpleNormValues(bm25stats.field));
|
||||
return new SloppyBM25DocScorer(bm25stats, context.reader().getNormValues(bm25stats.field));
|
||||
}
|
||||
|
||||
private class ExactBM25DocScorer extends ExactSimScorer {
|
||||
|
@ -53,7 +53,7 @@ import org.apache.lucene.util.SmallFloat; // javadoc
|
||||
* <a name="indextime"/>
|
||||
* At indexing time, the indexer calls {@link #computeNorm(FieldInvertState)}, allowing
|
||||
* the Similarity implementation to set a per-document value for the field that will
|
||||
* be later accessible via {@link AtomicReader#simpleNormValues(String)}. Lucene makes no assumption
|
||||
* be later accessible via {@link AtomicReader#getNormValues(String)}. Lucene makes no assumption
|
||||
* about what is in this norm, but it is most useful for encoding length normalization
|
||||
* information.
|
||||
* <p>
|
||||
|
@ -198,12 +198,12 @@ public abstract class SimilarityBase extends Similarity {
|
||||
ExactSimScorer subScorers[] = new ExactSimScorer[subStats.length];
|
||||
for (int i = 0; i < subScorers.length; i++) {
|
||||
BasicStats basicstats = (BasicStats) subStats[i];
|
||||
subScorers[i] = new BasicExactDocScorer(basicstats, context.reader().simpleNormValues(basicstats.field));
|
||||
subScorers[i] = new BasicExactDocScorer(basicstats, context.reader().getNormValues(basicstats.field));
|
||||
}
|
||||
return new MultiSimilarity.MultiExactDocScorer(subScorers);
|
||||
} else {
|
||||
BasicStats basicstats = (BasicStats) stats;
|
||||
return new BasicExactDocScorer(basicstats, context.reader().simpleNormValues(basicstats.field));
|
||||
return new BasicExactDocScorer(basicstats, context.reader().getNormValues(basicstats.field));
|
||||
}
|
||||
}
|
||||
|
||||
@ -216,12 +216,12 @@ public abstract class SimilarityBase extends Similarity {
|
||||
SloppySimScorer subScorers[] = new SloppySimScorer[subStats.length];
|
||||
for (int i = 0; i < subScorers.length; i++) {
|
||||
BasicStats basicstats = (BasicStats) subStats[i];
|
||||
subScorers[i] = new BasicSloppyDocScorer(basicstats, context.reader().simpleNormValues(basicstats.field));
|
||||
subScorers[i] = new BasicSloppyDocScorer(basicstats, context.reader().getNormValues(basicstats.field));
|
||||
}
|
||||
return new MultiSimilarity.MultiSloppyDocScorer(subScorers);
|
||||
} else {
|
||||
BasicStats basicstats = (BasicStats) stats;
|
||||
return new BasicSloppyDocScorer(basicstats, context.reader().simpleNormValues(basicstats.field));
|
||||
return new BasicSloppyDocScorer(basicstats, context.reader().getNormValues(basicstats.field));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -757,13 +757,13 @@ public abstract class TFIDFSimilarity extends Similarity {
|
||||
@Override
|
||||
public final ExactSimScorer exactSimScorer(SimWeight stats, AtomicReaderContext context) throws IOException {
|
||||
IDFStats idfstats = (IDFStats) stats;
|
||||
return new ExactTFIDFDocScorer(idfstats, context.reader().simpleNormValues(idfstats.field));
|
||||
return new ExactTFIDFDocScorer(idfstats, context.reader().getNormValues(idfstats.field));
|
||||
}
|
||||
|
||||
@Override
|
||||
public final SloppySimScorer sloppySimScorer(SimWeight stats, AtomicReaderContext context) throws IOException {
|
||||
IDFStats idfstats = (IDFStats) stats;
|
||||
return new SloppyTFIDFDocScorer(idfstats, context.reader().simpleNormValues(idfstats.field));
|
||||
return new SloppyTFIDFDocScorer(idfstats, context.reader().getNormValues(idfstats.field));
|
||||
}
|
||||
|
||||
// TODO: we can specialize these for omitNorms up front, but we should test that it doesn't confuse stupid hotspot.
|
||||
|
@ -21,7 +21,7 @@ import java.io.IOException;
|
||||
|
||||
import org.apache.lucene.analysis.Analyzer;
|
||||
import org.apache.lucene.analysis.MockAnalyzer;
|
||||
import org.apache.lucene.codecs.SimpleDocValuesFormat;
|
||||
import org.apache.lucene.codecs.DocValuesFormat;
|
||||
import org.apache.lucene.codecs.lucene41.Lucene41Codec;
|
||||
import org.apache.lucene.document.Document;
|
||||
import org.apache.lucene.document.Field;
|
||||
@ -708,11 +708,11 @@ public class TestDemoDocValue extends LuceneTestCase {
|
||||
// we don't use RandomIndexWriter because it might add more docvalues than we expect !!!!1
|
||||
IndexWriterConfig iwc = newIndexWriterConfig(TEST_VERSION_CURRENT, analyzer);
|
||||
// TODO: Fix the CFS/suffixing of Lucene41DocValues so it actually works with this
|
||||
final SimpleDocValuesFormat fast = SimpleDocValuesFormat.forName("Memory");
|
||||
final SimpleDocValuesFormat slow = SimpleDocValuesFormat.forName("SimpleText");
|
||||
final DocValuesFormat fast = DocValuesFormat.forName("Memory");
|
||||
final DocValuesFormat slow = DocValuesFormat.forName("SimpleText");
|
||||
iwc.setCodec(new Lucene41Codec() {
|
||||
@Override
|
||||
public SimpleDocValuesFormat getDocValuesFormatForField(String field) {
|
||||
public DocValuesFormat getDocValuesFormatForField(String field) {
|
||||
if ("dv1".equals(field)) {
|
||||
return fast;
|
||||
} else {
|
||||
|
@ -64,7 +64,7 @@ public class TestCustomNorms extends LuceneTestCase {
|
||||
writer.commit();
|
||||
writer.close();
|
||||
AtomicReader open = SlowCompositeReaderWrapper.wrap(DirectoryReader.open(dir));
|
||||
NumericDocValues norms = open.simpleNormValues(floatTestField);
|
||||
NumericDocValues norms = open.getNormValues(floatTestField);
|
||||
assertNotNull(norms);
|
||||
for (int i = 0; i < open.maxDoc(); i++) {
|
||||
StoredDocument document = open.document(i);
|
||||
|
@ -565,8 +565,8 @@ public void testFilesOpenClose() throws IOException {
|
||||
// check norms
|
||||
for(FieldInfo fieldInfo : fieldInfos1) {
|
||||
String curField = fieldInfo.name;
|
||||
NumericDocValues norms1 = MultiSimpleDocValues.simpleNormValues(index1, curField);
|
||||
NumericDocValues norms2 = MultiSimpleDocValues.simpleNormValues(index2, curField);
|
||||
NumericDocValues norms1 = MultiDocValues.getNormValues(index1, curField);
|
||||
NumericDocValues norms2 = MultiDocValues.getNormValues(index2, curField);
|
||||
if (norms1 != null && norms2 != null) {
|
||||
// todo: generalize this (like TestDuelingCodecs assert)
|
||||
for (int i = 0; i < index1.maxDoc(); i++) {
|
||||
|
@ -862,7 +862,7 @@ public class TestDocValuesIndexing extends LuceneTestCase {
|
||||
}
|
||||
w.commit();
|
||||
IndexReader reader = w.getReader();
|
||||
SortedDocValues docValues = MultiSimpleDocValues.simpleSortedValues(reader, "field");
|
||||
SortedDocValues docValues = MultiDocValues.getSortedValues(reader, "field");
|
||||
int[] sort = hash.sort(BytesRef.getUTF8SortedAsUnicodeComparator());
|
||||
BytesRef expected = new BytesRef();
|
||||
BytesRef actual = new BytesRef();
|
||||
|
@ -97,7 +97,7 @@ public class TestDocumentWriter extends LuceneTestCase {
|
||||
// omitNorms is true
|
||||
for (FieldInfo fi : reader.getFieldInfos()) {
|
||||
if (fi.isIndexed()) {
|
||||
assertTrue(fi.omitsNorms() == (reader.simpleNormValues(fi.name) == null));
|
||||
assertTrue(fi.omitsNorms() == (reader.getNormValues(fi.name) == null));
|
||||
}
|
||||
}
|
||||
reader.close();
|
||||
|
@ -528,8 +528,8 @@ public class TestDuelingCodecs extends LuceneTestCase {
|
||||
|
||||
for (String field : leftFields) {
|
||||
// nocommit cutover to per-segment comparison
|
||||
NumericDocValues leftNorms = MultiSimpleDocValues.simpleNormValues(leftReader, field);
|
||||
NumericDocValues rightNorms = MultiSimpleDocValues.simpleNormValues(rightReader, field);
|
||||
NumericDocValues leftNorms = MultiDocValues.getNormValues(leftReader, field);
|
||||
NumericDocValues rightNorms = MultiDocValues.getNormValues(rightReader, field);
|
||||
if (leftNorms != null && rightNorms != null) {
|
||||
assertDocValues(leftReader.maxDoc(), leftNorms, rightNorms);
|
||||
} else {
|
||||
@ -617,8 +617,8 @@ public class TestDuelingCodecs extends LuceneTestCase {
|
||||
for (String field : leftFields) {
|
||||
|
||||
{
|
||||
NumericDocValues leftValues = MultiSimpleDocValues.simpleNumericValues(leftReader, field);
|
||||
NumericDocValues rightValues = MultiSimpleDocValues.simpleNumericValues(rightReader, field);
|
||||
NumericDocValues leftValues = MultiDocValues.getNumericValues(leftReader, field);
|
||||
NumericDocValues rightValues = MultiDocValues.getNumericValues(rightReader, field);
|
||||
if (leftValues != null && rightValues != null) {
|
||||
assertDocValues(leftReader.maxDoc(), leftValues, rightValues);
|
||||
} else {
|
||||
@ -628,8 +628,8 @@ public class TestDuelingCodecs extends LuceneTestCase {
|
||||
}
|
||||
|
||||
{
|
||||
BinaryDocValues leftValues = MultiSimpleDocValues.simpleBinaryValues(leftReader, field);
|
||||
BinaryDocValues rightValues = MultiSimpleDocValues.simpleBinaryValues(rightReader, field);
|
||||
BinaryDocValues leftValues = MultiDocValues.getBinaryValues(leftReader, field);
|
||||
BinaryDocValues rightValues = MultiDocValues.getBinaryValues(rightReader, field);
|
||||
if (leftValues != null && rightValues != null) {
|
||||
BytesRef scratchLeft = new BytesRef();
|
||||
BytesRef scratchRight = new BytesRef();
|
||||
|
@ -67,7 +67,7 @@ public class TestMaxTermFrequency extends LuceneTestCase {
|
||||
}
|
||||
|
||||
public void test() throws Exception {
|
||||
NumericDocValues fooNorms = MultiSimpleDocValues.simpleNormValues(reader, "foo");
|
||||
NumericDocValues fooNorms = MultiDocValues.getNormValues(reader, "foo");
|
||||
for (int i = 0; i < reader.maxDoc(); i++) {
|
||||
assertEquals(expected.get(i).intValue(), fooNorms.get(i) & 0xff);
|
||||
}
|
||||
|
@ -83,12 +83,12 @@ public class TestNorms extends LuceneTestCase {
|
||||
IndexReader reader = writer.getReader();
|
||||
writer.close();
|
||||
|
||||
NumericDocValues fooNorms = MultiSimpleDocValues.simpleNormValues(reader, "foo");
|
||||
NumericDocValues fooNorms = MultiDocValues.getNormValues(reader, "foo");
|
||||
for (int i = 0; i < reader.maxDoc(); i++) {
|
||||
assertEquals(0, fooNorms.get(i));
|
||||
}
|
||||
|
||||
NumericDocValues barNorms = MultiSimpleDocValues.simpleNormValues(reader, "bar");
|
||||
NumericDocValues barNorms = MultiDocValues.getNormValues(reader, "bar");
|
||||
for (int i = 0; i < reader.maxDoc(); i++) {
|
||||
assertEquals(1, barNorms.get(i));
|
||||
}
|
||||
@ -101,7 +101,7 @@ public class TestNorms extends LuceneTestCase {
|
||||
Directory dir = newFSDirectory(_TestUtil.getTempDir("TestNorms.testMaxByteNorms"));
|
||||
buildIndex(dir);
|
||||
AtomicReader open = SlowCompositeReaderWrapper.wrap(DirectoryReader.open(dir));
|
||||
NumericDocValues normValues = open.simpleNormValues(byteTestField);
|
||||
NumericDocValues normValues = open.getNormValues(byteTestField);
|
||||
assertNotNull(normValues);
|
||||
for (int i = 0; i < open.maxDoc(); i++) {
|
||||
StoredDocument document = open.document(i);
|
||||
|
@ -290,12 +290,12 @@ public class TestOmitNorms extends LuceneTestCase {
|
||||
|
||||
IndexReader ir1 = riw.getReader();
|
||||
// todo: generalize
|
||||
NumericDocValues norms1 = MultiSimpleDocValues.simpleNormValues(ir1, field);
|
||||
NumericDocValues norms1 = MultiDocValues.getNormValues(ir1, field);
|
||||
|
||||
// fully merge and validate MultiNorms against single segment.
|
||||
riw.forceMerge(1);
|
||||
DirectoryReader ir2 = riw.getReader();
|
||||
NumericDocValues norms2 = getOnlySegmentReader(ir2).simpleNormValues(field);
|
||||
NumericDocValues norms2 = getOnlySegmentReader(ir2).getNormValues(field);
|
||||
|
||||
if (norms1 == null) {
|
||||
assertNull(norms2);
|
||||
|
@ -178,11 +178,11 @@ public class TestSegmentReader extends LuceneTestCase {
|
||||
for (int i=0; i<DocHelper.fields.length; i++) {
|
||||
IndexableField f = DocHelper.fields[i];
|
||||
if (f.fieldType().indexed()) {
|
||||
assertEquals(reader.simpleNormValues(f.name()) != null, !f.fieldType().omitNorms());
|
||||
assertEquals(reader.simpleNormValues(f.name()) != null, !DocHelper.noNorms.containsKey(f.name()));
|
||||
if (reader.simpleNormValues(f.name()) == null) {
|
||||
assertEquals(reader.getNormValues(f.name()) != null, !f.fieldType().omitNorms());
|
||||
assertEquals(reader.getNormValues(f.name()) != null, !DocHelper.noNorms.containsKey(f.name()));
|
||||
if (reader.getNormValues(f.name()) == null) {
|
||||
// test for norms of null
|
||||
NumericDocValues norms = MultiSimpleDocValues.simpleNormValues(reader, f.name());
|
||||
NumericDocValues norms = MultiDocValues.getNormValues(reader, f.name());
|
||||
assertNull(norms);
|
||||
}
|
||||
}
|
||||
|
@ -69,7 +69,7 @@ public class TestUniqueTermCount extends LuceneTestCase {
|
||||
}
|
||||
|
||||
public void test() throws Exception {
|
||||
NumericDocValues fooNorms = MultiSimpleDocValues.simpleNormValues(reader, "foo");
|
||||
NumericDocValues fooNorms = MultiDocValues.getNormValues(reader, "foo");
|
||||
assertNotNull(fooNorms);
|
||||
for (int i = 0; i < reader.maxDoc(); i++) {
|
||||
assertEquals(expected.get(i).longValue(), fooNorms.get(i));
|
||||
|
@ -77,8 +77,8 @@ public class TestSimilarityProvider extends LuceneTestCase {
|
||||
// sanity check of norms writer
|
||||
// TODO: generalize
|
||||
AtomicReader slow = new SlowCompositeReaderWrapper(reader);
|
||||
NumericDocValues fooNorms = slow.simpleNormValues("foo");
|
||||
NumericDocValues barNorms = slow.simpleNormValues("bar");
|
||||
NumericDocValues fooNorms = slow.getNormValues("foo");
|
||||
NumericDocValues barNorms = slow.getNormValues("bar");
|
||||
for (int i = 0; i < slow.maxDoc(); i++) {
|
||||
assertFalse(fooNorms.get(i) == barNorms.get(i));
|
||||
}
|
||||
|
@ -1148,7 +1148,7 @@ public class MemoryIndex {
|
||||
private Similarity cachedSimilarity;
|
||||
|
||||
@Override
|
||||
public NumericDocValues simpleNormValues(String field) {
|
||||
public NumericDocValues getNormValues(String field) {
|
||||
if (fieldInfos.get(field).omitsNorms())
|
||||
return null;
|
||||
NumericDocValues norms = cachedNormValues;
|
||||
|
@ -177,8 +177,8 @@ public class MemoryIndexTest extends BaseTokenStreamTestCase {
|
||||
if (iwTerms == null) {
|
||||
assertNull(memTerms);
|
||||
} else {
|
||||
NumericDocValues normValues = competitor.simpleNormValues(field);
|
||||
NumericDocValues memNormValues = memIndexReader.simpleNormValues(field);
|
||||
NumericDocValues normValues = competitor.getNormValues(field);
|
||||
NumericDocValues memNormValues = memIndexReader.getNormValues(field);
|
||||
if (normValues != null) {
|
||||
// mem idx always computes norms on the fly
|
||||
assertNotNull(memNormValues);
|
||||
|
@ -62,7 +62,7 @@ public class NormValueSource extends ValueSource {
|
||||
if (similarity == null) {
|
||||
throw new UnsupportedOperationException("requires a TFIDFSimilarity (such as DefaultSimilarity)");
|
||||
}
|
||||
final NumericDocValues norms = readerContext.reader().simpleNormValues(field);
|
||||
final NumericDocValues norms = readerContext.reader().getNormValues(field);
|
||||
|
||||
if (norms == null) {
|
||||
return new ConstDoubleDocValues(0.0, this);
|
||||
|
@ -132,8 +132,8 @@ public final class FieldFilterAtomicReader extends FilterAtomicReader {
|
||||
}
|
||||
|
||||
@Override
|
||||
public NumericDocValues simpleNormValues(String field) throws IOException {
|
||||
return hasField(field) ? super.simpleNormValues(field) : null;
|
||||
public NumericDocValues getNormValues(String field) throws IOException {
|
||||
return hasField(field) ? super.getNormValues(field) : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -28,7 +28,7 @@ import java.util.Random;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.lucene.codecs.PostingsFormat;
|
||||
import org.apache.lucene.codecs.SimpleDocValuesFormat;
|
||||
import org.apache.lucene.codecs.DocValuesFormat;
|
||||
import org.apache.lucene.codecs.asserting.AssertingPostingsFormat;
|
||||
import org.apache.lucene.codecs.lucene41.Lucene41Codec;
|
||||
import org.apache.lucene.codecs.lucene41.Lucene41PostingsFormat;
|
||||
@ -45,7 +45,7 @@ import org.apache.lucene.codecs.mocksep.MockSepPostingsFormat;
|
||||
import org.apache.lucene.codecs.nestedpulsing.NestedPulsingPostingsFormat;
|
||||
import org.apache.lucene.codecs.pulsing.Pulsing41PostingsFormat;
|
||||
import org.apache.lucene.codecs.simpletext.SimpleTextPostingsFormat;
|
||||
import org.apache.lucene.codecs.simpletext.SimpleTextSimpleDocValuesFormat;
|
||||
import org.apache.lucene.codecs.simpletext.SimpleTextDocValuesFormat;
|
||||
import org.apache.lucene.util.LuceneTestCase;
|
||||
import org.apache.lucene.util._TestUtil;
|
||||
|
||||
@ -63,7 +63,7 @@ public class RandomCodec extends Lucene41Codec {
|
||||
private List<PostingsFormat> formats = new ArrayList<PostingsFormat>();
|
||||
|
||||
/** Shuffled list of docvalues formats to use for new mappings */
|
||||
private List<SimpleDocValuesFormat> dvFormats = new ArrayList<SimpleDocValuesFormat>();
|
||||
private List<DocValuesFormat> dvFormats = new ArrayList<DocValuesFormat>();
|
||||
|
||||
/** unique set of format names this codec knows about */
|
||||
public Set<String> formatNames = new HashSet<String>();
|
||||
@ -76,7 +76,7 @@ public class RandomCodec extends Lucene41Codec {
|
||||
// otherwise DWPT's .toString() calls that iterate over the map can
|
||||
// cause concurrentmodificationexception if indexwriter's infostream is on
|
||||
private Map<String,PostingsFormat> previousMappings = Collections.synchronizedMap(new HashMap<String,PostingsFormat>());
|
||||
private Map<String,SimpleDocValuesFormat> previousDVMappings = Collections.synchronizedMap(new HashMap<String,SimpleDocValuesFormat>());
|
||||
private Map<String,DocValuesFormat> previousDVMappings = Collections.synchronizedMap(new HashMap<String,DocValuesFormat>());
|
||||
private final int perFieldSeed;
|
||||
|
||||
@Override
|
||||
@ -96,11 +96,11 @@ public class RandomCodec extends Lucene41Codec {
|
||||
}
|
||||
|
||||
@Override
|
||||
public SimpleDocValuesFormat getDocValuesFormatForField(String name) {
|
||||
SimpleDocValuesFormat codec = previousDVMappings.get(name);
|
||||
public DocValuesFormat getDocValuesFormatForField(String name) {
|
||||
DocValuesFormat codec = previousDVMappings.get(name);
|
||||
if (codec == null) {
|
||||
codec = dvFormats.get(Math.abs(perFieldSeed ^ name.hashCode()) % dvFormats.size());
|
||||
if (codec instanceof SimpleTextSimpleDocValuesFormat && perFieldSeed % 5 != 0) {
|
||||
if (codec instanceof SimpleTextDocValuesFormat && perFieldSeed % 5 != 0) {
|
||||
// make simpletext rarer, choose again
|
||||
codec = dvFormats.get(Math.abs(perFieldSeed ^ name.toUpperCase(Locale.ROOT).hashCode()) % dvFormats.size());
|
||||
}
|
||||
@ -143,7 +143,7 @@ public class RandomCodec extends Lucene41Codec {
|
||||
|
||||
addDocValues(avoidCodecs,
|
||||
new DiskDocValuesFormat(),
|
||||
new SimpleTextSimpleDocValuesFormat(),
|
||||
new SimpleTextDocValuesFormat(),
|
||||
new MemoryDocValuesFormat());
|
||||
|
||||
Collections.shuffle(formats, random);
|
||||
@ -167,8 +167,8 @@ public class RandomCodec extends Lucene41Codec {
|
||||
}
|
||||
}
|
||||
|
||||
private final void addDocValues(Set<String> avoidCodecs, SimpleDocValuesFormat... docvalues) {
|
||||
for (SimpleDocValuesFormat d : docvalues) {
|
||||
private final void addDocValues(Set<String> avoidCodecs, DocValuesFormat... docvalues) {
|
||||
for (DocValuesFormat d : docvalues) {
|
||||
if (!avoidCodecs.contains(d.getName())) {
|
||||
dvFormats.add(d);
|
||||
dvFormatNames.add(d.getName());
|
||||
|
@ -36,7 +36,7 @@ import org.apache.lucene.analysis.util.TokenFilterFactory;
|
||||
import org.apache.lucene.analysis.util.TokenizerFactory;
|
||||
import org.apache.lucene.codecs.Codec;
|
||||
import org.apache.lucene.codecs.PostingsFormat;
|
||||
import org.apache.lucene.codecs.SimpleDocValuesFormat;
|
||||
import org.apache.lucene.codecs.DocValuesFormat;
|
||||
import org.apache.lucene.analysis.util.WordlistLoader;
|
||||
import org.apache.solr.common.ResourceLoader;
|
||||
import org.apache.solr.handler.admin.CoreAdminHandler;
|
||||
@ -179,7 +179,7 @@ public class SolrResourceLoader implements ResourceLoader
|
||||
void reloadLuceneSPI() {
|
||||
// Codecs:
|
||||
PostingsFormat.reloadPostingsFormats(this.classLoader);
|
||||
SimpleDocValuesFormat.reloadDocValuesFormats(this.classLoader);
|
||||
DocValuesFormat.reloadDocValuesFormats(this.classLoader);
|
||||
Codec.reloadCodecs(this.classLoader);
|
||||
// Analysis:
|
||||
CharFilterFactory.reloadCharFilters(this.classLoader);
|
||||
|
@ -403,7 +403,7 @@ public class TestDocSet extends LuceneTestCase {
|
||||
}
|
||||
|
||||
@Override
|
||||
public NumericDocValues simpleNormValues(String field) {
|
||||
public NumericDocValues getNormValues(String field) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -333,9 +333,9 @@ public class DocumentBuilderTest extends SolrTestCaseJ4 {
|
||||
|
||||
DefaultSimilarity sim = (DefaultSimilarity) searcher.getSimilarity();
|
||||
|
||||
NumericDocValues titleNorms = reader.simpleNormValues("title");
|
||||
NumericDocValues fooNorms = reader.simpleNormValues("foo_t");
|
||||
NumericDocValues textNorms = reader.simpleNormValues("text");
|
||||
NumericDocValues titleNorms = reader.getNormValues("title");
|
||||
NumericDocValues fooNorms = reader.getNormValues("foo_t");
|
||||
NumericDocValues textNorms = reader.getNormValues("text");
|
||||
|
||||
assertEquals(expectedNorm(sim, 2, TITLE_BOOST * DOC_BOOST),
|
||||
titleNorms.get(docid));
|
||||
|
Loading…
x
Reference in New Issue
Block a user