pull from DV under FC.getXXX if possible

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/branches/lucene4547@1410878 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael McCandless 2012-11-18 12:00:04 +00:00
parent 6735e95b1f
commit f9bfb920c6
18 changed files with 667 additions and 574 deletions

View File

@ -414,7 +414,7 @@ public class SimpleTextSimpleDocValuesFormat extends SimpleDocValuesFormat {
}
@Override
public NumericDocValues getDirectNumeric(FieldInfo fieldInfo) throws IOException {
public NumericDocValues getNumeric(FieldInfo fieldInfo) throws IOException {
final OneField field = fields.get(fieldInfo.name);
// SegmentCoreReaders already verifies this field is
@ -454,7 +454,7 @@ public class SimpleTextSimpleDocValuesFormat extends SimpleDocValuesFormat {
}
@Override
public BinaryDocValues getDirectBinary(FieldInfo fieldInfo) throws IOException {
public BinaryDocValues getBinary(FieldInfo fieldInfo) throws IOException {
final OneField field = fields.get(fieldInfo.name);
// SegmentCoreReaders already verifies this field is
@ -497,7 +497,7 @@ public class SimpleTextSimpleDocValuesFormat extends SimpleDocValuesFormat {
}
@Override
public SortedDocValues getDirectSorted(FieldInfo fieldInfo) throws IOException {
public SortedDocValues getSorted(FieldInfo fieldInfo) throws IOException {
final OneField field = fields.get(fieldInfo.name);
// SegmentCoreReaders already verifies this field is

View File

@ -20,6 +20,7 @@ package org.apache.lucene.codecs;
import java.io.IOException;
import org.apache.lucene.index.AtomicReader;
import org.apache.lucene.index.BinaryDocValues;
import org.apache.lucene.index.DocValues.Source;
import org.apache.lucene.index.FieldInfos;
import org.apache.lucene.index.MergeState;
@ -36,10 +37,14 @@ public abstract class BinaryDocValuesConsumer {
for (AtomicReader reader : mergeState.readers) {
final int maxDoc = reader.maxDoc();
final Bits liveDocs = reader.getLiveDocs();
final Source source = reader.docValues(mergeState.fieldInfo.name).getDirectSource();
// nocommit what if this is null...? need default source?
final BinaryDocValues source = reader.getBinaryDocValues(mergeState.fieldInfo.name);
for (int i = 0; i < maxDoc; i++) {
if (liveDocs == null || liveDocs.get(i)) {
add(source.getBytes(i, bytes));
source.get(i, bytes);
add(bytes);
}
docCount++;
mergeState.checkAbort.work(300);

View File

@ -20,10 +20,11 @@ package org.apache.lucene.codecs;
import java.io.IOException;
import org.apache.lucene.index.AtomicReader;
import org.apache.lucene.index.DocValues.Source;
import org.apache.lucene.index.FieldInfo;
import org.apache.lucene.index.FieldInfos;
import org.apache.lucene.index.MergeState;
import org.apache.lucene.index.DocValues.Source;
import org.apache.lucene.index.NumericDocValues;
import org.apache.lucene.util.Bits;
public abstract class NumericDocValuesConsumer {
@ -35,10 +36,11 @@ public abstract class NumericDocValuesConsumer {
for (AtomicReader reader : mergeState.readers) {
final int maxDoc = reader.maxDoc();
final Bits liveDocs = reader.getLiveDocs();
final Source source = reader.docValues(mergeState.fieldInfo.name).getDirectSource();
// nocommit what if this is null...? need default source?
final NumericDocValues source = reader.getNumericDocValues(mergeState.fieldInfo.name);
for (int i = 0; i < maxDoc; i++) {
if (liveDocs == null || liveDocs.get(i)) {
add(source.getInt(i));
add(source.get(i));
}
docCount++;
mergeState.checkAbort.work(300);

View File

@ -35,86 +35,9 @@ public abstract class SimpleDVProducer implements Closeable {
this.maxDoc = maxDoc;
}
public abstract NumericDocValues getDirectNumeric(FieldInfo field) throws IOException;
public abstract NumericDocValues getNumeric(FieldInfo field) throws IOException;
/** Loads all values into RAM. */
public NumericDocValues getNumeric(FieldInfo field) throws IOException {
NumericDocValues source = getDirectNumeric(field);
// nocommit more ram efficient?
final long[] values = new long[maxDoc];
for(int docID=0;docID<maxDoc;docID++) {
values[docID] = source.get(docID);
}
return new NumericDocValues() {
@Override
public long get(int docID) {
return values[docID];
}
};
}
public abstract BinaryDocValues getBinary(FieldInfo field) throws IOException;
public abstract BinaryDocValues getDirectBinary(FieldInfo field) throws IOException;
/** Loads all values into RAM. */
public BinaryDocValues getBinary(FieldInfo field) throws IOException {
BinaryDocValues source = getDirectBinary(field);
// nocommit more ram efficient
final byte[][] values = new byte[maxDoc][];
BytesRef scratch = new BytesRef();
for(int docID=0;docID<maxDoc;docID++) {
source.get(docID, scratch);
values[docID] = new byte[scratch.length];
System.arraycopy(scratch.bytes, scratch.offset, values[docID], 0, scratch.length);
}
return new BinaryDocValues() {
@Override
public void get(int docID, BytesRef result) {
result.bytes = values[docID];
result.offset = 0;
result.length = result.bytes.length;
}
};
}
public abstract SortedDocValues getDirectSorted(FieldInfo field) throws IOException;
/** Loads all values into RAM. */
public SortedDocValues getSorted(FieldInfo field) throws IOException {
SortedDocValues source = getDirectSorted(field);
final int valueCount = source.getValueCount();
final byte[][] values = new byte[valueCount][];
BytesRef scratch = new BytesRef();
for(int ord=0;ord<valueCount;ord++) {
source.lookupOrd(ord, scratch);
values[ord] = new byte[scratch.length];
System.arraycopy(scratch.bytes, scratch.offset, values[ord], 0, scratch.length);
}
final int[] ords = new int[maxDoc];
for(int docID=0;docID<maxDoc;docID++) {
ords[docID] = source.getOrd(docID);
}
return new SortedDocValues() {
@Override
public int getOrd(int docID) {
return ords[docID];
}
@Override
public void lookupOrd(int ord, BytesRef result) {
result.bytes = values[ord];
result.offset = 0;
result.length = result.bytes.length;
}
@Override
public int getValueCount() {
return valueCount;
}
};
}
public abstract SortedDocValues getSorted(FieldInfo field) throws IOException;
}

View File

@ -25,6 +25,7 @@ import org.apache.lucene.index.AtomicReader;
import org.apache.lucene.index.DocValues.SortedSource;
import org.apache.lucene.index.DocValues;
import org.apache.lucene.index.MergeState;
import org.apache.lucene.index.SortedDocValues;
import org.apache.lucene.util.Bits;
import org.apache.lucene.util.BytesRef;
import org.apache.lucene.util.FixedBitSet;
@ -57,7 +58,7 @@ public abstract class SortedDocValuesConsumer {
AtomicReader reader;
FixedBitSet liveTerms;
int ord = -1;
SortedSource source;
SortedDocValues values;
BytesRef scratch = new BytesRef();
// nocommit can we factor out the compressed fields
@ -67,10 +68,10 @@ public abstract class SortedDocValuesConsumer {
int[] segOrdToMergedOrd;
public BytesRef nextTerm() {
while (ord < source.getValueCount()-1) {
while (ord < values.getValueCount()-1) {
ord++;
if (liveTerms == null || liveTerms.get(ord)) {
source.getByOrd(ord, scratch);
values.lookupOrd(ord, scratch);
return scratch;
} else {
// Skip "deleted" terms (ie, terms that were not
@ -98,26 +99,20 @@ public abstract class SortedDocValuesConsumer {
// First pass: mark "live" terms
for (AtomicReader reader : mergeState.readers) {
DocValues docvalues = reader.docValues(mergeState.fieldInfo.name);
final SortedSource source;
// nocommit what if this is null...? need default source?
int maxDoc = reader.maxDoc();
if (docvalues == null) {
source = DocValues.getDefaultSortedSource(mergeState.fieldInfo.getDocValuesType(), maxDoc);
} else {
source = (SortedSource) docvalues.getDirectSource();
}
SegmentState state = new SegmentState();
state.reader = reader;
state.source = source;
state.values = reader.getSortedDocValues(mergeState.fieldInfo.name);
segStates.add(state);
assert source.getValueCount() < Integer.MAX_VALUE;
assert state.values.getValueCount() < Integer.MAX_VALUE;
if (reader.hasDeletions()) {
state.liveTerms = new FixedBitSet(source.getValueCount());
state.liveTerms = new FixedBitSet(state.values.getValueCount());
Bits liveDocs = reader.getLiveDocs();
for(int docID=0;docID<maxDoc;docID++) {
if (liveDocs.get(docID)) {
state.liveTerms.set(source.ord(docID));
state.liveTerms.set(state.values.getOrd(docID));
}
}
}
@ -135,7 +130,7 @@ public abstract class SortedDocValuesConsumer {
// nocommit we could defer this to 3rd pass (and
// reduce transient RAM spike) but then
// we'd spend more effort computing the mapping...:
segState.segOrdToMergedOrd = new int[segState.source.getValueCount()];
segState.segOrdToMergedOrd = new int[segState.values.getValueCount()];
q.add(segState);
}
}
@ -184,7 +179,7 @@ public abstract class SortedDocValuesConsumer {
int maxDoc = segState.reader.maxDoc();
for(int docID=0;docID<maxDoc;docID++) {
if (liveDocs == null || liveDocs.get(docID)) {
int segOrd = segState.source.ord(docID);
int segOrd = segState.values.getOrd(docID);
int mergedOrd = segState.segOrdToMergedOrd[segOrd];
consumer.addDoc(mergedOrd);
}

View File

@ -42,7 +42,9 @@ public class DoubleDocValuesField extends StoredField {
*/
public static final FieldType TYPE = new FieldType();
static {
TYPE.setDocValueType(DocValues.Type.FLOAT_64);
// nocommit kinda messy ... if user calls .numericValue
// they get back strange int ... hmmm
TYPE.setDocValueType(DocValues.Type.FIXED_INTS_64);
TYPE.freeze();
}
@ -54,6 +56,8 @@ public class DoubleDocValuesField extends StoredField {
*/
public DoubleDocValuesField(String name, double value) {
super(name, TYPE);
fieldsData = Double.valueOf(value);
// nocommit kinda messy ... if user calls .numericValue
// they get back strange int ... hmmm
fieldsData = Double.doubleToRawLongBits(value);
}
}

View File

@ -41,7 +41,9 @@ public class FloatDocValuesField extends StoredField {
*/
public static final FieldType TYPE = new FieldType();
static {
TYPE.setDocValueType(DocValues.Type.FLOAT_32);
// nocommit kinda messy ... if user calls .numericValue
// they get back strange int ... hmmm
TYPE.setDocValueType(DocValues.Type.FIXED_INTS_32);
TYPE.freeze();
}
@ -53,6 +55,8 @@ public class FloatDocValuesField extends StoredField {
*/
public FloatDocValuesField(String name, float value) {
super(name, TYPE);
fieldsData = Float.valueOf(value);
// nocommit kinda messy ... if user calls .numericValue
// they get back strange int ... hmmm
fieldsData = Float.floatToRawIntBits(value);
}
}

View File

@ -164,13 +164,13 @@ public abstract class AtomicReader extends IndexReader {
public abstract DocValues docValues(String field) throws IOException;
// nocommit javadocs
public abstract NumericDocValues getNumericDocValues(String field, boolean direct) throws IOException;
public abstract NumericDocValues getNumericDocValues(String field) throws IOException;
// nocommit javadocs
public abstract BinaryDocValues getBinaryDocValues(String field, boolean direct) throws IOException;
public abstract BinaryDocValues getBinaryDocValues(String field) throws IOException;
// nocommit javadocs
public abstract SortedDocValues getSortedDocValues(String field, boolean direct) throws IOException;
public abstract SortedDocValues getSortedDocValues(String field) throws IOException;
/**
* Returns {@link DocValues} for this field's normalization values.

View File

@ -412,21 +412,21 @@ public class FilterAtomicReader extends AtomicReader {
}
@Override
public NumericDocValues getNumericDocValues(String field, boolean direct) throws IOException {
public NumericDocValues getNumericDocValues(String field) throws IOException {
ensureOpen();
return in.getNumericDocValues(field, direct);
return in.getNumericDocValues(field);
}
@Override
public BinaryDocValues getBinaryDocValues(String field, boolean direct) throws IOException {
public BinaryDocValues getBinaryDocValues(String field) throws IOException {
ensureOpen();
return in.getBinaryDocValues(field, direct);
return in.getBinaryDocValues(field);
}
@Override
public SortedDocValues getSortedDocValues(String field, boolean direct) throws IOException {
public SortedDocValues getSortedDocValues(String field) throws IOException {
ensureOpen();
return in.getSortedDocValues(field, direct);
return in.getSortedDocValues(field);
}
@Override

View File

@ -271,24 +271,24 @@ public final class ParallelAtomicReader extends AtomicReader {
}
@Override
public NumericDocValues getNumericDocValues(String field, boolean direct) throws IOException {
public NumericDocValues getNumericDocValues(String field) throws IOException {
ensureOpen();
AtomicReader reader = fieldToReader.get(field);
return reader == null ? null : reader.getNumericDocValues(field, direct);
return reader == null ? null : reader.getNumericDocValues(field);
}
@Override
public BinaryDocValues getBinaryDocValues(String field, boolean direct) throws IOException {
public BinaryDocValues getBinaryDocValues(String field) throws IOException {
ensureOpen();
AtomicReader reader = fieldToReader.get(field);
return reader == null ? null : reader.getBinaryDocValues(field, direct);
return reader == null ? null : reader.getBinaryDocValues(field);
}
@Override
public SortedDocValues getSortedDocValues(String field, boolean direct) throws IOException {
public SortedDocValues getSortedDocValues(String field) throws IOException {
ensureOpen();
AtomicReader reader = fieldToReader.get(field);
return reader == null ? null : reader.getSortedDocValues(field, direct);
return reader == null ? null : reader.getSortedDocValues(field);
}
@Override

View File

@ -66,8 +66,6 @@ final class SegmentCoreReaders {
final TermVectorsReader termVectorsReaderOrig;
final CompoundFileDirectory cfsReader;
private final Map<FieldInfo,Object> docValuesCache = new HashMap<FieldInfo,Object>();
final CloseableThreadLocal<StoredFieldsReader> fieldsReaderLocal = new CloseableThreadLocal<StoredFieldsReader>() {
@Override
protected StoredFieldsReader initialValue() {
@ -155,72 +153,60 @@ final class SegmentCoreReaders {
}
// nocommit shrink the sync'd part to a cache miss
synchronized NumericDocValues getNumericDocValues(String field, boolean direct) throws IOException {
synchronized NumericDocValues getNumericDocValues(String field) throws IOException {
FieldInfo fi = fieldInfos.fieldInfo(field);
if (fi == null) {
// Field does not exist
return null;
}
if (fi.getDocValuesType() == null) {
// Field was not indexed with doc values
return null;
}
if (!DocValues.isNumber(fi.getDocValuesType())) {
throw new IllegalArgumentException("field \"" + field + "\" was not indexed as a numeric doc values field");
// DocValues were not numeric
return null;
}
if (direct) {
return simpleDVProducer.getDirectNumeric(fi);
} else {
if (!docValuesCache.containsKey(fi)) {
NumericDocValues dv = simpleDVProducer.getNumeric(fi);
if (dv != null) {
docValuesCache.put(fi, dv);
}
}
return (NumericDocValues) docValuesCache.get(fi);
}
return simpleDVProducer.getNumeric(fi);
}
// nocommit shrink the sync'd part to a cache miss
synchronized BinaryDocValues getBinaryDocValues(String field, boolean direct) throws IOException {
synchronized BinaryDocValues getBinaryDocValues(String field) throws IOException {
FieldInfo fi = fieldInfos.fieldInfo(field);
if (fi == null) {
// Field does not exist
return null;
}
if (fi.getDocValuesType() == null) {
// Field was not indexed with doc values
return null;
}
if (!DocValues.isBytes(fi.getDocValuesType())) {
throw new IllegalArgumentException("field \"" + field + "\" was not indexed as a binary doc values field");
// DocValues were not binary
return null;
}
if (direct) {
return simpleDVProducer.getDirectBinary(fi);
} else {
if (!docValuesCache.containsKey(fi)) {
BinaryDocValues dv = simpleDVProducer.getBinary(fi);
if (dv != null) {
docValuesCache.put(fi, dv);
}
}
return (BinaryDocValues) docValuesCache.get(fi);
}
return simpleDVProducer.getBinary(fi);
}
// nocommit shrink the sync'd part to a cache miss
synchronized SortedDocValues getSortedDocValues(String field, boolean direct) throws IOException {
synchronized SortedDocValues getSortedDocValues(String field) throws IOException {
FieldInfo fi = fieldInfos.fieldInfo(field);
if (fi == null) {
// Field does not exist
return null;
}
if (fi.getDocValuesType() == null) {
// Field was not indexed with doc values
return null;
}
if (!DocValues.isSortedBytes(fi.getDocValuesType())) {
throw new IllegalArgumentException("field \"" + field + "\" was not indexed as a sorted doc values field");
// DocValues were not sorted
return null;
}
if (direct) {
return simpleDVProducer.getDirectSorted(fi);
} else {
if (!docValuesCache.containsKey(fi)) {
SortedDocValues dv = simpleDVProducer.getSorted(fi);
if (dv != null) {
docValuesCache.put(fi, dv);
}
}
return (SortedDocValues) docValuesCache.get(fi);
}
return simpleDVProducer.getSorted(fi);
}
// nocommit binary, sorted too

View File

@ -226,18 +226,18 @@ public final class SegmentReader extends AtomicReader {
}
@Override
public NumericDocValues getNumericDocValues(String field, boolean direct) throws IOException {
return core.getNumericDocValues(field, direct);
public NumericDocValues getNumericDocValues(String field) throws IOException {
return core.getNumericDocValues(field);
}
@Override
public BinaryDocValues getBinaryDocValues(String field, boolean direct) throws IOException {
return core.getBinaryDocValues(field, direct);
public BinaryDocValues getBinaryDocValues(String field) throws IOException {
return core.getBinaryDocValues(field);
}
@Override
public SortedDocValues getSortedDocValues(String field, boolean direct) throws IOException {
return core.getSortedDocValues(field, direct);
public SortedDocValues getSortedDocValues(String field) throws IOException {
return core.getSortedDocValues(field);
}
@Override

View File

@ -89,19 +89,19 @@ public final class SlowCompositeReaderWrapper extends AtomicReader {
}
@Override
public NumericDocValues getNumericDocValues(String field, boolean direct) throws IOException {
public NumericDocValues getNumericDocValues(String field) throws IOException {
// nocommit todo
return null;
}
@Override
public BinaryDocValues getBinaryDocValues(String field, boolean direct) throws IOException {
public BinaryDocValues getBinaryDocValues(String field) throws IOException {
// nocommit todo
return null;
}
@Override
public SortedDocValues getSortedDocValues(String field, boolean direct) throws IOException {
public SortedDocValues getSortedDocValues(String field) throws IOException {
// nocommit todo
return null;
}

View File

@ -87,6 +87,7 @@ import org.apache.lucene.util.packed.PackedInts;
* @lucene.experimental
*/
public abstract class FieldComparator<T> {
// nocommit remove the doc values comparators
/**
* Compare hit at slot1 with hit at slot2.

View File

@ -49,7 +49,7 @@ import org.apache.lucene.util.LuceneTestCase;
* to this class.
*/
// nocommit don't suppress any:
@SuppressCodecs({"Direct", "Memory", "Lucene41", "MockRandom", "Lucene40", "Compressing"})
@SuppressCodecs({"Asserting", "Direct", "Memory", "Lucene41", "MockRandom", "Lucene40", "Compressing"})
public class TestDemoDocValue extends LuceneTestCase {
public void testDemoNumber() throws IOException {
@ -82,7 +82,7 @@ public class TestDemoDocValue extends LuceneTestCase {
StoredDocument hitDoc = isearcher.doc(hits.scoreDocs[i].doc);
assertEquals(text, hitDoc.get("fieldname"));
assert ireader.leaves().size() == 1;
NumericDocValues dv = ireader.leaves().get(0).reader().getNumericDocValues("dv", random().nextBoolean());
NumericDocValues dv = ireader.leaves().get(0).reader().getNumericDocValues("dv");
assertEquals(5, dv.get(hits.scoreDocs[i].doc));
}
@ -113,7 +113,7 @@ public class TestDemoDocValue extends LuceneTestCase {
// Now search the index:
IndexReader ireader = DirectoryReader.open(directory); // read-only=true
assert ireader.leaves().size() == 1;
NumericDocValues dv = ireader.leaves().get(0).reader().getNumericDocValues("dv", random().nextBoolean());
NumericDocValues dv = ireader.leaves().get(0).reader().getNumericDocValues("dv");
assertEquals(1, dv.get(0));
assertEquals(2, dv.get(1));
@ -147,7 +147,7 @@ public class TestDemoDocValue extends LuceneTestCase {
// Now search the index:
IndexReader ireader = DirectoryReader.open(directory); // read-only=true
assert ireader.leaves().size() == 1;
NumericDocValues dv = ireader.leaves().get(0).reader().getNumericDocValues("dv", random().nextBoolean());
NumericDocValues dv = ireader.leaves().get(0).reader().getNumericDocValues("dv");
for(int i=0;i<2;i++) {
StoredDocument doc2 = ireader.leaves().get(0).reader().document(i);
long expected;
@ -186,7 +186,7 @@ public class TestDemoDocValue extends LuceneTestCase {
// Now search the index:
IndexReader ireader = DirectoryReader.open(directory); // read-only=true
assert ireader.leaves().size() == 1;
NumericDocValues dv = ireader.leaves().get(0).reader().getNumericDocValues("dv", random().nextBoolean());
NumericDocValues dv = ireader.leaves().get(0).reader().getNumericDocValues("dv");
assertEquals(Long.MIN_VALUE, dv.get(0));
assertEquals(Long.MAX_VALUE, dv.get(1));
@ -225,7 +225,7 @@ public class TestDemoDocValue extends LuceneTestCase {
StoredDocument hitDoc = isearcher.doc(hits.scoreDocs[i].doc);
assertEquals(text, hitDoc.get("fieldname"));
assert ireader.leaves().size() == 1;
BinaryDocValues dv = ireader.leaves().get(0).reader().getBinaryDocValues("dv", random().nextBoolean());
BinaryDocValues dv = ireader.leaves().get(0).reader().getBinaryDocValues("dv");
dv.get(hits.scoreDocs[i].doc, scratch);
assertEquals(new BytesRef("hello world"), scratch);
}
@ -262,7 +262,7 @@ public class TestDemoDocValue extends LuceneTestCase {
// Now search the index:
IndexReader ireader = DirectoryReader.open(directory); // read-only=true
assert ireader.leaves().size() == 1;
BinaryDocValues dv = ireader.leaves().get(0).reader().getBinaryDocValues("dv", random().nextBoolean());
BinaryDocValues dv = ireader.leaves().get(0).reader().getBinaryDocValues("dv");
BytesRef scratch = new BytesRef();
for(int i=0;i<2;i++) {
StoredDocument doc2 = ireader.leaves().get(0).reader().document(i);
@ -311,7 +311,7 @@ public class TestDemoDocValue extends LuceneTestCase {
StoredDocument hitDoc = isearcher.doc(hits.scoreDocs[i].doc);
assertEquals(text, hitDoc.get("fieldname"));
assert ireader.leaves().size() == 1;
SortedDocValues dv = ireader.leaves().get(0).reader().getSortedDocValues("dv", random().nextBoolean());
SortedDocValues dv = ireader.leaves().get(0).reader().getSortedDocValues("dv");
dv.lookupOrd(dv.getOrd(hits.scoreDocs[i].doc), scratch);
assertEquals(new BytesRef("hello world"), scratch);
}
@ -343,7 +343,7 @@ public class TestDemoDocValue extends LuceneTestCase {
// Now search the index:
IndexReader ireader = DirectoryReader.open(directory); // read-only=true
assert ireader.leaves().size() == 1;
SortedDocValues dv = ireader.leaves().get(0).reader().getSortedDocValues("dv", random().nextBoolean());
SortedDocValues dv = ireader.leaves().get(0).reader().getSortedDocValues("dv");
BytesRef scratch = new BytesRef();
dv.lookupOrd(dv.getOrd(0), scratch);
assertEquals("hello world 1", scratch.utf8ToString());
@ -380,7 +380,7 @@ public class TestDemoDocValue extends LuceneTestCase {
// Now search the index:
IndexReader ireader = DirectoryReader.open(directory); // read-only=true
assert ireader.leaves().size() == 1;
SortedDocValues dv = ireader.leaves().get(0).reader().getSortedDocValues("dv", random().nextBoolean());
SortedDocValues dv = ireader.leaves().get(0).reader().getSortedDocValues("dv");
BytesRef scratch = new BytesRef();
for(int i=0;i<2;i++) {
StoredDocument doc2 = ireader.leaves().get(0).reader().document(i);

View File

@ -740,17 +740,17 @@ public class MemoryIndex {
}
// nocommit todo
public NumericDocValues getNumericDocValues(String field, boolean direct) {
public NumericDocValues getNumericDocValues(String field) {
return null;
}
// nocommit todo
public BinaryDocValues getBinaryDocValues(String field, boolean direct) {
public BinaryDocValues getBinaryDocValues(String field) {
return null;
}
// nocommit todo
public SortedDocValues getSortedDocValues(String field, boolean direct) {
public SortedDocValues getSortedDocValues(String field) {
return null;
}

View File

@ -399,17 +399,17 @@ public class TestDocSet extends LuceneTestCase {
}
@Override
public NumericDocValues getNumericDocValues(String field, boolean direct) {
public NumericDocValues getNumericDocValues(String field) {
return null;
}
@Override
public BinaryDocValues getBinaryDocValues(String field, boolean direct) {
public BinaryDocValues getBinaryDocValues(String field) {
return null;
}
@Override
public SortedDocValues getSortedDocValues(String field, boolean direct) {
public SortedDocValues getSortedDocValues(String field) {
return null;
}