You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by rm...@apache.org on 2011/12/09 17:43:48 UTC
svn commit: r1212506 [3/4] - in /lucene/dev/branches/lucene3622: lucene/
lucene/contrib/memory/src/java/org/apache/lucene/index/memory/
lucene/contrib/misc/src/java/org/apache/lucene/document/
lucene/src/java/org/apache/lucene/document/ lucene/src/java...
Modified: lucene/dev/branches/lucene3622/lucene/src/test-framework/java/org/apache/lucene/index/codecs/mocksep/MockSepDocValuesFormat.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3622/lucene/src/test-framework/java/org/apache/lucene/index/codecs/mocksep/MockSepDocValuesFormat.java?rev=1212506&r1=1212505&r2=1212506&view=diff
==============================================================================
--- lucene/dev/branches/lucene3622/lucene/src/test-framework/java/org/apache/lucene/index/codecs/mocksep/MockSepDocValuesFormat.java (original)
+++ lucene/dev/branches/lucene3622/lucene/src/test-framework/java/org/apache/lucene/index/codecs/mocksep/MockSepDocValuesFormat.java Fri Dec 9 16:43:45 2011
@@ -20,12 +20,12 @@ package org.apache.lucene.index.codecs.m
import java.io.IOException;
import java.util.Set;
+import org.apache.lucene.index.PerDocValues;
import org.apache.lucene.index.PerDocWriteState;
import org.apache.lucene.index.SegmentInfo;
import org.apache.lucene.index.SegmentReadState;
import org.apache.lucene.index.codecs.DocValuesFormat;
import org.apache.lucene.index.codecs.PerDocConsumer;
-import org.apache.lucene.index.codecs.PerDocValues;
import org.apache.lucene.index.codecs.sep.SepDocValuesConsumer;
import org.apache.lucene.index.codecs.sep.SepDocValuesProducer;
import org.apache.lucene.store.Directory;
Modified: lucene/dev/branches/lucene3622/lucene/src/test/org/apache/lucene/index/TestAddIndexes.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3622/lucene/src/test/org/apache/lucene/index/TestAddIndexes.java?rev=1212506&r1=1212505&r2=1212506&view=diff
==============================================================================
--- lucene/dev/branches/lucene3622/lucene/src/test/org/apache/lucene/index/TestAddIndexes.java (original)
+++ lucene/dev/branches/lucene3622/lucene/src/test/org/apache/lucene/index/TestAddIndexes.java Fri Dec 9 16:43:45 2011
@@ -27,7 +27,7 @@ import org.apache.lucene.analysis.MockAn
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
import org.apache.lucene.document.FieldType;
-import org.apache.lucene.document.IndexDocValuesField;
+import org.apache.lucene.document.DocValuesField;
import org.apache.lucene.document.StringField;
import org.apache.lucene.document.TextField;
import org.apache.lucene.index.IndexWriterConfig.OpenMode;
@@ -47,7 +47,6 @@ import org.apache.lucene.index.codecs.lu
import org.apache.lucene.index.codecs.lucene40.Lucene40StoredFieldsFormat;
import org.apache.lucene.index.codecs.lucene40.Lucene40TermVectorsFormat;
import org.apache.lucene.index.codecs.pulsing.Pulsing40PostingsFormat;
-import org.apache.lucene.index.values.IndexDocValues;
import org.apache.lucene.search.DocIdSetIterator;
import org.apache.lucene.search.PhraseQuery;
import org.apache.lucene.store.AlreadyClosedException;
@@ -1254,7 +1253,7 @@ public class TestAddIndexes extends Luce
RandomIndexWriter w = new RandomIndexWriter(random, d1);
Document doc = new Document();
doc.add(newField("id", "1", StringField.TYPE_STORED));
- IndexDocValuesField dv = new IndexDocValuesField("dv");
+ DocValuesField dv = new DocValuesField("dv");
dv.setInt(1);
doc.add(dv);
w.addDocument(doc);
@@ -1265,7 +1264,7 @@ public class TestAddIndexes extends Luce
w = new RandomIndexWriter(random, d2);
doc = new Document();
doc.add(newField("id", "2", StringField.TYPE_STORED));
- dv = new IndexDocValuesField("dv");
+ dv = new DocValuesField("dv");
dv.setInt(2);
doc.add(dv);
w.addDocument(doc);
@@ -1285,7 +1284,7 @@ public class TestAddIndexes extends Luce
w.close();
IndexReader sr = getOnlySegmentReader(r3);
assertEquals(2, sr.numDocs());
- IndexDocValues docValues = sr.perDocValues().docValues("dv");
+ DocValues docValues = sr.perDocValues().docValues("dv");
assertNotNull(docValues);
r3.close();
d3.close();
Modified: lucene/dev/branches/lucene3622/lucene/src/test/org/apache/lucene/index/TestDuelingCodecs.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3622/lucene/src/test/org/apache/lucene/index/TestDuelingCodecs.java?rev=1212506&r1=1212505&r2=1212506&view=diff
==============================================================================
--- lucene/dev/branches/lucene3622/lucene/src/test/org/apache/lucene/index/TestDuelingCodecs.java (original)
+++ lucene/dev/branches/lucene3622/lucene/src/test/org/apache/lucene/index/TestDuelingCodecs.java Fri Dec 9 16:43:45 2011
@@ -25,10 +25,6 @@ import org.apache.lucene.analysis.Analyz
import org.apache.lucene.analysis.MockAnalyzer;
import org.apache.lucene.document.Document;
import org.apache.lucene.index.codecs.Codec;
-import org.apache.lucene.index.codecs.PerDocValues;
-import org.apache.lucene.index.values.IndexDocValues;
-import org.apache.lucene.index.values.IndexDocValues.Source;
-import org.apache.lucene.index.values.ValueType;
import org.apache.lucene.search.DocIdSetIterator;
import org.apache.lucene.store.Directory;
import org.apache.lucene.util.Bits;
@@ -536,8 +532,8 @@ public class TestDuelingCodecs extends L
FieldsEnum fieldsEnum = leftFields.iterator();
String field;
while ((field = fieldsEnum.next()) != null) {
- IndexDocValues leftDocValues = leftPerDoc.docValues(field);
- IndexDocValues rightDocValues = rightPerDoc.docValues(field);
+ DocValues leftDocValues = leftPerDoc.docValues(field);
+ DocValues rightDocValues = rightPerDoc.docValues(field);
if (leftDocValues == null || rightDocValues == null) {
assertNull(info, leftDocValues);
assertNull(info, rightDocValues);
@@ -551,8 +547,8 @@ public class TestDuelingCodecs extends L
/**
* checks source API
*/
- public void assertDocValuesSource(Source left, Source right) throws Exception {
- ValueType leftType = left.type();
+ public void assertDocValuesSource(DocValues.Source left, DocValues.Source right) throws Exception {
+ DocValues.Type leftType = left.type();
assertEquals(info, leftType, right.type());
switch(leftType) {
case VAR_INTS:
Modified: lucene/dev/branches/lucene3622/lucene/src/test/org/apache/lucene/index/TestIndexableField.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3622/lucene/src/test/org/apache/lucene/index/TestIndexableField.java?rev=1212506&r1=1212505&r2=1212506&view=diff
==============================================================================
--- lucene/dev/branches/lucene3622/lucene/src/test/org/apache/lucene/index/TestIndexableField.java (original)
+++ lucene/dev/branches/lucene3622/lucene/src/test/org/apache/lucene/index/TestIndexableField.java Fri Dec 9 16:43:45 2011
@@ -28,8 +28,7 @@ import org.apache.lucene.document.Docume
import org.apache.lucene.document.NumericField.DataType;
import org.apache.lucene.document.NumericField;
import org.apache.lucene.document.StringField;
-import org.apache.lucene.index.values.PerDocFieldValues;
-import org.apache.lucene.index.values.ValueType;
+import org.apache.lucene.index.DocValues;
import org.apache.lucene.search.BooleanClause;
import org.apache.lucene.search.BooleanQuery;
import org.apache.lucene.search.IndexSearcher;
@@ -162,7 +161,7 @@ public class TestIndexableField extends
}
@Override
- public ValueType docValuesType() {
+ public DocValues.Type docValuesType() {
return null;
}
Modified: lucene/dev/branches/lucene3622/lucene/src/test/org/apache/lucene/index/values/TestDocValues.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3622/lucene/src/test/org/apache/lucene/index/values/TestDocValues.java?rev=1212506&r1=1212505&r2=1212506&view=diff
==============================================================================
--- lucene/dev/branches/lucene3622/lucene/src/test/org/apache/lucene/index/values/TestDocValues.java (original)
+++ lucene/dev/branches/lucene3622/lucene/src/test/org/apache/lucene/index/values/TestDocValues.java Fri Dec 9 16:43:45 2011
@@ -20,12 +20,14 @@ package org.apache.lucene.index.values;
import java.io.IOException;
import java.util.Comparator;
+import org.apache.lucene.index.DocValues;
+import org.apache.lucene.index.DocValues.SortedSource;
+import org.apache.lucene.index.DocValues.Source;
+import org.apache.lucene.index.DocValues.Type;
import org.apache.lucene.index.codecs.lucene40.values.Bytes;
import org.apache.lucene.index.codecs.lucene40.values.Floats;
import org.apache.lucene.index.codecs.lucene40.values.Ints;
import org.apache.lucene.index.codecs.lucene40.values.Writer;
-import org.apache.lucene.index.values.IndexDocValues.SortedSource;
-import org.apache.lucene.index.values.IndexDocValues.Source;
import org.apache.lucene.store.Directory;
import org.apache.lucene.util.BytesRef;
import org.apache.lucene.util.Counter;
@@ -33,6 +35,7 @@ import org.apache.lucene.util.LuceneTest
import org.apache.lucene.util.UnicodeUtil;
import org.apache.lucene.util._TestUtil;
+// TODO: some of this should be under lucene40 codec tests? is talking to codec directly?f
public class TestDocValues extends LuceneTestCase {
private static final Comparator<BytesRef> COMP = BytesRef.getUTF8SortedAsUnicodeComparator();
// TODO -- for sorted test, do our own Sort of the
@@ -80,12 +83,12 @@ public class TestDocValues extends Lucen
w.finish(maxDoc);
assertEquals(0, trackBytes.get());
- IndexDocValues r = Bytes.getValues(dir, "test", mode, fixedSize, maxDoc, COMP, newIOContext(random));
+ DocValues r = Bytes.getValues(dir, "test", mode, fixedSize, maxDoc, COMP, newIOContext(random));
// Verify we can load source twice:
for (int iter = 0; iter < 2; iter++) {
Source s;
- IndexDocValues.SortedSource ss;
+ DocValues.SortedSource ss;
if (mode == Bytes.Mode.SORTED) {
// default is unicode so we can simply pass null here
s = ss = getSortedSource(r);
@@ -159,19 +162,19 @@ public class TestDocValues extends Lucen
{ Long.MIN_VALUE + 1, 1 }, { -1, Long.MAX_VALUE },
{ Long.MIN_VALUE, -1 }, { 1, Long.MAX_VALUE },
{ -1, Long.MAX_VALUE - 1 }, { Long.MIN_VALUE + 2, 1 }, };
- ValueType[] expectedTypes = new ValueType[] { ValueType.FIXED_INTS_64,
- ValueType.FIXED_INTS_64, ValueType.FIXED_INTS_64,
- ValueType.FIXED_INTS_64, ValueType.VAR_INTS, ValueType.VAR_INTS,
- ValueType.VAR_INTS, };
+ Type[] expectedTypes = new Type[] { Type.FIXED_INTS_64,
+ Type.FIXED_INTS_64, Type.FIXED_INTS_64,
+ Type.FIXED_INTS_64, Type.VAR_INTS, Type.VAR_INTS,
+ Type.VAR_INTS, };
for (int i = 0; i < minMax.length; i++) {
Directory dir = newDirectory();
final Counter trackBytes = Counter.newCounter();
- Writer w = Ints.getWriter(dir, "test", trackBytes, ValueType.VAR_INTS, newIOContext(random));
+ Writer w = Ints.getWriter(dir, "test", trackBytes, Type.VAR_INTS, newIOContext(random));
w.add(0, minMax[i][0]);
w.add(1, minMax[i][1]);
w.finish(2);
assertEquals(0, trackBytes.get());
- IndexDocValues r = Ints.getValues(dir, "test", 2, ValueType.VAR_INTS, newIOContext(random));
+ DocValues r = Ints.getValues(dir, "test", 2, Type.VAR_INTS, newIOContext(random));
Source source = getSource(r);
assertEquals(i + " with min: " + minMax[i][0] + " max: " + minMax[i][1],
expectedTypes[i], source.type());
@@ -184,14 +187,14 @@ public class TestDocValues extends Lucen
}
public void testVInts() throws IOException {
- testInts(ValueType.VAR_INTS, 63);
+ testInts(Type.VAR_INTS, 63);
}
public void testFixedInts() throws IOException {
- testInts(ValueType.FIXED_INTS_64, 63);
- testInts(ValueType.FIXED_INTS_32, 31);
- testInts(ValueType.FIXED_INTS_16, 15);
- testInts(ValueType.FIXED_INTS_8, 7);
+ testInts(Type.FIXED_INTS_64, 63);
+ testInts(Type.FIXED_INTS_32, 31);
+ testInts(Type.FIXED_INTS_16, 15);
+ testInts(Type.FIXED_INTS_8, 7);
}
@@ -199,12 +202,12 @@ public class TestDocValues extends Lucen
byte[] sourceArray = new byte[] {1,2,3};
Directory dir = newDirectory();
final Counter trackBytes = Counter.newCounter();
- Writer w = Ints.getWriter(dir, "test", trackBytes, ValueType.FIXED_INTS_8, newIOContext(random));
+ Writer w = Ints.getWriter(dir, "test", trackBytes, Type.FIXED_INTS_8, newIOContext(random));
for (int i = 0; i < sourceArray.length; i++) {
w.add(i, (long) sourceArray[i]);
}
w.finish(sourceArray.length);
- IndexDocValues r = Ints.getValues(dir, "test", sourceArray.length, ValueType.FIXED_INTS_8, newIOContext(random));
+ DocValues r = Ints.getValues(dir, "test", sourceArray.length, Type.FIXED_INTS_8, newIOContext(random));
Source source = r.getSource();
assertTrue(source.hasArray());
byte[] loaded = ((byte[])source.getArray());
@@ -220,12 +223,12 @@ public class TestDocValues extends Lucen
short[] sourceArray = new short[] {1,2,3};
Directory dir = newDirectory();
final Counter trackBytes = Counter.newCounter();
- Writer w = Ints.getWriter(dir, "test", trackBytes, ValueType.FIXED_INTS_16, newIOContext(random));
+ Writer w = Ints.getWriter(dir, "test", trackBytes, Type.FIXED_INTS_16, newIOContext(random));
for (int i = 0; i < sourceArray.length; i++) {
w.add(i, (long) sourceArray[i]);
}
w.finish(sourceArray.length);
- IndexDocValues r = Ints.getValues(dir, "test", sourceArray.length, ValueType.FIXED_INTS_16, newIOContext(random));
+ DocValues r = Ints.getValues(dir, "test", sourceArray.length, Type.FIXED_INTS_16, newIOContext(random));
Source source = r.getSource();
assertTrue(source.hasArray());
short[] loaded = ((short[])source.getArray());
@@ -241,12 +244,12 @@ public class TestDocValues extends Lucen
long[] sourceArray = new long[] {1,2,3};
Directory dir = newDirectory();
final Counter trackBytes = Counter.newCounter();
- Writer w = Ints.getWriter(dir, "test", trackBytes, ValueType.FIXED_INTS_64, newIOContext(random));
+ Writer w = Ints.getWriter(dir, "test", trackBytes, Type.FIXED_INTS_64, newIOContext(random));
for (int i = 0; i < sourceArray.length; i++) {
w.add(i, sourceArray[i]);
}
w.finish(sourceArray.length);
- IndexDocValues r = Ints.getValues(dir, "test", sourceArray.length, ValueType.FIXED_INTS_64, newIOContext(random));
+ DocValues r = Ints.getValues(dir, "test", sourceArray.length, Type.FIXED_INTS_64, newIOContext(random));
Source source = r.getSource();
assertTrue(source.hasArray());
long[] loaded = ((long[])source.getArray());
@@ -262,12 +265,12 @@ public class TestDocValues extends Lucen
int[] sourceArray = new int[] {1,2,3};
Directory dir = newDirectory();
final Counter trackBytes = Counter.newCounter();
- Writer w = Ints.getWriter(dir, "test", trackBytes, ValueType.FIXED_INTS_32, newIOContext(random));
+ Writer w = Ints.getWriter(dir, "test", trackBytes, Type.FIXED_INTS_32, newIOContext(random));
for (int i = 0; i < sourceArray.length; i++) {
w.add(i, (long) sourceArray[i]);
}
w.finish(sourceArray.length);
- IndexDocValues r = Ints.getValues(dir, "test", sourceArray.length, ValueType.FIXED_INTS_32, newIOContext(random));
+ DocValues r = Ints.getValues(dir, "test", sourceArray.length, Type.FIXED_INTS_32, newIOContext(random));
Source source = r.getSource();
assertTrue(source.hasArray());
int[] loaded = ((int[])source.getArray());
@@ -283,12 +286,12 @@ public class TestDocValues extends Lucen
float[] sourceArray = new float[] {1,2,3};
Directory dir = newDirectory();
final Counter trackBytes = Counter.newCounter();
- Writer w = Floats.getWriter(dir, "test", trackBytes, newIOContext(random), ValueType.FLOAT_32);
+ Writer w = Floats.getWriter(dir, "test", trackBytes, newIOContext(random), Type.FLOAT_32);
for (int i = 0; i < sourceArray.length; i++) {
w.add(i, sourceArray[i]);
}
w.finish(sourceArray.length);
- IndexDocValues r = Floats.getValues(dir, "test", 3, newIOContext(random), ValueType.FLOAT_32);
+ DocValues r = Floats.getValues(dir, "test", 3, newIOContext(random), Type.FLOAT_32);
Source source = r.getSource();
assertTrue(source.hasArray());
float[] loaded = ((float[])source.getArray());
@@ -304,12 +307,12 @@ public class TestDocValues extends Lucen
double[] sourceArray = new double[] {1,2,3};
Directory dir = newDirectory();
final Counter trackBytes = Counter.newCounter();
- Writer w = Floats.getWriter(dir, "test", trackBytes, newIOContext(random), ValueType.FLOAT_64);
+ Writer w = Floats.getWriter(dir, "test", trackBytes, newIOContext(random), Type.FLOAT_64);
for (int i = 0; i < sourceArray.length; i++) {
w.add(i, sourceArray[i]);
}
w.finish(sourceArray.length);
- IndexDocValues r = Floats.getValues(dir, "test", 3, newIOContext(random), ValueType.FLOAT_64);
+ DocValues r = Floats.getValues(dir, "test", 3, newIOContext(random), Type.FLOAT_64);
Source source = r.getSource();
assertTrue(source.hasArray());
double[] loaded = ((double[])source.getArray());
@@ -321,7 +324,7 @@ public class TestDocValues extends Lucen
dir.close();
}
- private void testInts(ValueType type, int maxBit) throws IOException {
+ private void testInts(Type type, int maxBit) throws IOException {
long maxV = 1;
final int NUM_VALUES = 333 + random.nextInt(333);
final long[] values = new long[NUM_VALUES];
@@ -338,7 +341,7 @@ public class TestDocValues extends Lucen
w.finish(NUM_VALUES + additionalDocs);
assertEquals(0, trackBytes.get());
- IndexDocValues r = Ints.getValues(dir, "test", NUM_VALUES + additionalDocs, type, newIOContext(random));
+ DocValues r = Ints.getValues(dir, "test", NUM_VALUES + additionalDocs, type, newIOContext(random));
for (int iter = 0; iter < 2; iter++) {
Source s = getSource(r);
assertEquals(type, s.type());
@@ -354,17 +357,17 @@ public class TestDocValues extends Lucen
}
public void testFloats4() throws IOException {
- runTestFloats(ValueType.FLOAT_32, 0.00001);
+ runTestFloats(Type.FLOAT_32, 0.00001);
}
- private void runTestFloats(ValueType type, double delta) throws IOException {
+ private void runTestFloats(Type type, double delta) throws IOException {
Directory dir = newDirectory();
final Counter trackBytes = Counter.newCounter();
Writer w = Floats.getWriter(dir, "test", trackBytes, newIOContext(random), type);
final int NUM_VALUES = 777 + random.nextInt(777);;
final double[] values = new double[NUM_VALUES];
for (int i = 0; i < NUM_VALUES; i++) {
- final double v = type == ValueType.FLOAT_32 ? random.nextFloat() : random
+ final double v = type == Type.FLOAT_32 ? random.nextFloat() : random
.nextDouble();
values[i] = v;
w.add(i, v);
@@ -373,7 +376,7 @@ public class TestDocValues extends Lucen
w.finish(NUM_VALUES + additionalValues);
assertEquals(0, trackBytes.get());
- IndexDocValues r = Floats.getValues(dir, "test", NUM_VALUES + additionalValues, newIOContext(random), type);
+ DocValues r = Floats.getValues(dir, "test", NUM_VALUES + additionalValues, newIOContext(random), type);
for (int iter = 0; iter < 2; iter++) {
Source s = getSource(r);
for (int i = 0; i < NUM_VALUES; i++) {
@@ -385,11 +388,11 @@ public class TestDocValues extends Lucen
}
public void testFloats8() throws IOException {
- runTestFloats(ValueType.FLOAT_64, 0.0);
+ runTestFloats(Type.FLOAT_64, 0.0);
}
- private Source getSource(IndexDocValues values) throws IOException {
+ private Source getSource(DocValues values) throws IOException {
// getSource uses cache internally
switch(random.nextInt(5)) {
case 3:
@@ -403,7 +406,7 @@ public class TestDocValues extends Lucen
}
}
- private SortedSource getSortedSource(IndexDocValues values) throws IOException {
+ private SortedSource getSortedSource(DocValues values) throws IOException {
return getSource(values).asSortedSource();
}
Modified: lucene/dev/branches/lucene3622/lucene/src/test/org/apache/lucene/index/values/TestDocValuesIndexing.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3622/lucene/src/test/org/apache/lucene/index/values/TestDocValuesIndexing.java?rev=1212506&r1=1212505&r2=1212506&view=diff
==============================================================================
--- lucene/dev/branches/lucene3622/lucene/src/test/org/apache/lucene/index/values/TestDocValuesIndexing.java (original)
+++ lucene/dev/branches/lucene3622/lucene/src/test/org/apache/lucene/index/values/TestDocValuesIndexing.java Fri Dec 9 16:43:45 2011
@@ -27,21 +27,23 @@ import java.util.List;
import org.apache.lucene.analysis.MockAnalyzer;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
-import org.apache.lucene.document.IndexDocValuesField;
+import org.apache.lucene.document.DocValuesField;
import org.apache.lucene.document.StringField;
import org.apache.lucene.document.TextField;
import org.apache.lucene.index.CorruptIndexException;
+import org.apache.lucene.index.DocValues;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.IndexWriter;
import org.apache.lucene.index.IndexWriterConfig;
import org.apache.lucene.index.LogDocMergePolicy;
import org.apache.lucene.index.LogMergePolicy;
import org.apache.lucene.index.MultiPerDocValues;
+import org.apache.lucene.index.PerDocValues;
import org.apache.lucene.index.RandomIndexWriter;
import org.apache.lucene.index.Term;
+import org.apache.lucene.index.DocValues.Source;
+import org.apache.lucene.index.DocValues.Type;
import org.apache.lucene.index.codecs.Codec;
-import org.apache.lucene.index.codecs.PerDocValues;
-import org.apache.lucene.index.values.IndexDocValues.Source;
import org.apache.lucene.search.*;
import org.apache.lucene.store.Directory;
import org.apache.lucene.store.LockObtainFailedException;
@@ -76,7 +78,7 @@ public class TestDocValuesIndexing exten
IndexWriter writer = new IndexWriter(dir, writerConfig(false));
for (int i = 0; i < 5; i++) {
Document doc = new Document();
- IndexDocValuesField valuesField = new IndexDocValuesField("docId");
+ DocValuesField valuesField = new DocValuesField("docId");
valuesField.setInt(i);
doc.add(valuesField);
doc.add(new TextField("docId", "" + i));
@@ -102,7 +104,7 @@ public class TestDocValuesIndexing exten
TopDocs search = searcher.search(query, 10);
assertEquals(5, search.totalHits);
ScoreDoc[] scoreDocs = search.scoreDocs;
- IndexDocValues docValues = MultiPerDocValues.getPerDocs(reader).docValues("docId");
+ DocValues docValues = MultiPerDocValues.getPerDocs(reader).docValues("docId");
Source source = docValues.getSource();
for (int i = 0; i < scoreDocs.length; i++) {
assertEquals(i, scoreDocs[i].doc);
@@ -130,10 +132,10 @@ public class TestDocValuesIndexing exten
public void testAddIndexes() throws IOException {
int valuesPerIndex = 10;
- List<ValueType> values = Arrays.asList(ValueType.values());
+ List<Type> values = Arrays.asList(Type.values());
Collections.shuffle(values, random);
- ValueType first = values.get(0);
- ValueType second = values.get(1);
+ Type first = values.get(0);
+ Type second = values.get(1);
// index first index
Directory d_1 = newDirectory();
IndexWriter w_1 = new IndexWriter(d_1, writerConfig(random.nextBoolean()));
@@ -256,11 +258,11 @@ public class TestDocValuesIndexing exten
Directory d = newDirectory();
IndexWriter w = new IndexWriter(d, cfg);
final int numValues = 50 + atLeast(10);
- final List<ValueType> numVariantList = new ArrayList<ValueType>(NUMERICS);
+ final List<Type> numVariantList = new ArrayList<Type>(NUMERICS);
// run in random order to test if fill works correctly during merges
Collections.shuffle(numVariantList, random);
- for (ValueType val : numVariantList) {
+ for (Type val : numVariantList) {
FixedBitSet deleted = indexValues(w, numValues, val, numVariantList,
withDeletions, 7);
List<Closeable> closeables = new ArrayList<Closeable>();
@@ -277,7 +279,7 @@ public class TestDocValuesIndexing exten
case FIXED_INTS_32:
case FIXED_INTS_64:
case VAR_INTS: {
- IndexDocValues intsReader = getDocValues(r, val.name());
+ DocValues intsReader = getDocValues(r, val.name());
assertNotNull(intsReader);
Source ints = getSource(intsReader);
@@ -298,7 +300,7 @@ public class TestDocValuesIndexing exten
break;
case FLOAT_32:
case FLOAT_64: {
- IndexDocValues floatReader = getDocValues(r, val.name());
+ DocValues floatReader = getDocValues(r, val.name());
assertNotNull(floatReader);
Source floats = getSource(floatReader);
for (int i = 0; i < base; i++) {
@@ -333,11 +335,11 @@ public class TestDocValuesIndexing exten
throws CorruptIndexException, LockObtainFailedException, IOException {
final Directory d = newDirectory();
IndexWriter w = new IndexWriter(d, cfg);
- final List<ValueType> byteVariantList = new ArrayList<ValueType>(BYTES);
+ final List<Type> byteVariantList = new ArrayList<Type>(BYTES);
// run in random order to test if fill works correctly during merges
Collections.shuffle(byteVariantList, random);
final int numValues = 50 + atLeast(10);
- for (ValueType byteIndexValue : byteVariantList) {
+ for (Type byteIndexValue : byteVariantList) {
List<Closeable> closeables = new ArrayList<Closeable>();
final int bytesSize = 1 + atLeast(50);
FixedBitSet deleted = indexValues(w, numValues, byteIndexValue,
@@ -346,7 +348,7 @@ public class TestDocValuesIndexing exten
assertEquals(0, r.numDeletedDocs());
final int numRemainingValues = numValues - deleted.cardinality();
final int base = r.numDocs() - numRemainingValues;
- IndexDocValues bytesReader = getDocValues(r, byteIndexValue.name());
+ DocValues bytesReader = getDocValues(r, byteIndexValue.name());
assertNotNull("field " + byteIndexValue.name()
+ " returned null reader - maybe merged failed", bytesReader);
Source bytes = getSource(bytesReader);
@@ -416,7 +418,7 @@ public class TestDocValuesIndexing exten
d.close();
}
- private IndexDocValues getDocValues(IndexReader reader, String field)
+ private DocValues getDocValues(IndexReader reader, String field)
throws IOException {
boolean singleSeg = reader.getSequentialSubReaders().length == 1;
PerDocValues perDoc = singleSeg ? reader.getSequentialSubReaders()[0].perDocValues()
@@ -425,7 +427,7 @@ public class TestDocValuesIndexing exten
case 0:
return perDoc.docValues(field);
case 1:
- IndexDocValues docValues = perDoc.docValues(field);
+ DocValues docValues = perDoc.docValues(field);
if (docValues != null) {
return docValues;
}
@@ -436,7 +438,7 @@ public class TestDocValuesIndexing exten
throw new RuntimeException();
}
- private Source getSource(IndexDocValues values) throws IOException {
+ private Source getSource(DocValues values) throws IOException {
// getSource uses cache internally
switch(random.nextInt(5)) {
case 3:
@@ -451,24 +453,24 @@ public class TestDocValuesIndexing exten
}
- private static EnumSet<ValueType> BYTES = EnumSet.of(ValueType.BYTES_FIXED_DEREF,
- ValueType.BYTES_FIXED_STRAIGHT, ValueType.BYTES_VAR_DEREF,
- ValueType.BYTES_VAR_STRAIGHT, ValueType.BYTES_FIXED_SORTED, ValueType.BYTES_VAR_SORTED);
-
- private static EnumSet<ValueType> NUMERICS = EnumSet.of(ValueType.VAR_INTS,
- ValueType.FIXED_INTS_16, ValueType.FIXED_INTS_32,
- ValueType.FIXED_INTS_64,
- ValueType.FIXED_INTS_8,
- ValueType.FLOAT_32,
- ValueType.FLOAT_64);
+ private static EnumSet<Type> BYTES = EnumSet.of(Type.BYTES_FIXED_DEREF,
+ Type.BYTES_FIXED_STRAIGHT, Type.BYTES_VAR_DEREF,
+ Type.BYTES_VAR_STRAIGHT, Type.BYTES_FIXED_SORTED, Type.BYTES_VAR_SORTED);
+
+ private static EnumSet<Type> NUMERICS = EnumSet.of(Type.VAR_INTS,
+ Type.FIXED_INTS_16, Type.FIXED_INTS_32,
+ Type.FIXED_INTS_64,
+ Type.FIXED_INTS_8,
+ Type.FLOAT_32,
+ Type.FLOAT_64);
- private FixedBitSet indexValues(IndexWriter w, int numValues, ValueType value,
- List<ValueType> valueVarList, boolean withDeletions, int bytesSize)
+ private FixedBitSet indexValues(IndexWriter w, int numValues, Type value,
+ List<Type> valueVarList, boolean withDeletions, int bytesSize)
throws CorruptIndexException, IOException {
final boolean isNumeric = NUMERICS.contains(value);
FixedBitSet deleted = new FixedBitSet(numValues);
Document doc = new Document();
- IndexDocValuesField valField = new IndexDocValuesField(value.name());
+ DocValuesField valField = new DocValuesField(value.name());
doc.add(valField);
final BytesRef bytesRef = new BytesRef();
@@ -522,7 +524,7 @@ public class TestDocValuesIndexing exten
if (i % 7 == 0) {
if (withDeletions && random.nextBoolean()) {
- ValueType val = valueVarList.get(random.nextInt(1 + valueVarList
+ Type val = valueVarList.get(random.nextInt(1 + valueVarList
.indexOf(value)));
final int randInt = val == value ? random.nextInt(1 + i) : random
.nextInt(numValues);
@@ -545,11 +547,11 @@ public class TestDocValuesIndexing exten
return deleted;
}
- public void testMultiValuedIndexDocValuesField() throws Exception {
+ public void testMultiValuedDocValuesField() throws Exception {
Directory d = newDirectory();
RandomIndexWriter w = new RandomIndexWriter(random, d);
Document doc = new Document();
- IndexDocValuesField f = new IndexDocValuesField("field");
+ DocValuesField f = new DocValuesField("field");
f.setInt(17);
// Index doc values are single-valued so we should not
// be able to add same field more than once:
@@ -577,12 +579,12 @@ public class TestDocValuesIndexing exten
Directory d = newDirectory();
RandomIndexWriter w = new RandomIndexWriter(random, d);
Document doc = new Document();
- IndexDocValuesField f = new IndexDocValuesField("field");
+ DocValuesField f = new DocValuesField("field");
f.setInt(17);
// Index doc values are single-valued so we should not
// be able to add same field more than once:
doc.add(f);
- IndexDocValuesField f2 = new IndexDocValuesField("field");
+ DocValuesField f2 = new DocValuesField("field");
f2.setFloat(22.0);
doc.add(f2);
try {
Modified: lucene/dev/branches/lucene3622/lucene/src/test/org/apache/lucene/index/values/TestTypePromotion.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3622/lucene/src/test/org/apache/lucene/index/values/TestTypePromotion.java?rev=1212506&r1=1212505&r2=1212506&view=diff
==============================================================================
--- lucene/dev/branches/lucene3622/lucene/src/test/org/apache/lucene/index/values/TestTypePromotion.java (original)
+++ lucene/dev/branches/lucene3622/lucene/src/test/org/apache/lucene/index/values/TestTypePromotion.java Fri Dec 9 16:43:45 2011
@@ -7,18 +7,20 @@ import java.util.Random;
import org.apache.lucene.analysis.MockAnalyzer;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
-import org.apache.lucene.document.IndexDocValuesField;
+import org.apache.lucene.document.DocValuesField;
import org.apache.lucene.document.TextField;
import org.apache.lucene.index.CorruptIndexException;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.IndexReader.ReaderContext;
+import org.apache.lucene.index.DocValues;
+import org.apache.lucene.index.DocValues.Source;
+import org.apache.lucene.index.DocValues.Type;
import org.apache.lucene.index.IndexWriter;
import org.apache.lucene.index.IndexWriterConfig;
import org.apache.lucene.index.NoMergePolicy;
import org.apache.lucene.index.SlowMultiReaderWrapper;
import org.apache.lucene.index.codecs.Codec;
import org.apache.lucene.index.codecs.lucene40.values.BytesRefUtils;
-import org.apache.lucene.index.values.IndexDocValues.Source;
import org.apache.lucene.store.Directory;
import org.apache.lucene.util.BytesRef;
import org.apache.lucene.util.LuceneTestCase;
@@ -47,22 +49,22 @@ public class TestTypePromotion extends L
assumeFalse("cannot work with preflex codec", Codec.getDefault().getName().equals("Lucene3x"));
}
- private static EnumSet<ValueType> INTEGERS = EnumSet.of(ValueType.VAR_INTS,
- ValueType.FIXED_INTS_16, ValueType.FIXED_INTS_32,
- ValueType.FIXED_INTS_64, ValueType.FIXED_INTS_8);
-
- private static EnumSet<ValueType> FLOATS = EnumSet.of(ValueType.FLOAT_32,
- ValueType.FLOAT_64);
-
- private static EnumSet<ValueType> UNSORTED_BYTES = EnumSet.of(
- ValueType.BYTES_FIXED_DEREF, ValueType.BYTES_FIXED_STRAIGHT,
- ValueType.BYTES_VAR_STRAIGHT, ValueType.BYTES_VAR_DEREF);
+ private static EnumSet<Type> INTEGERS = EnumSet.of(Type.VAR_INTS,
+ Type.FIXED_INTS_16, Type.FIXED_INTS_32,
+ Type.FIXED_INTS_64, Type.FIXED_INTS_8);
+
+ private static EnumSet<Type> FLOATS = EnumSet.of(Type.FLOAT_32,
+ Type.FLOAT_64);
+
+ private static EnumSet<Type> UNSORTED_BYTES = EnumSet.of(
+ Type.BYTES_FIXED_DEREF, Type.BYTES_FIXED_STRAIGHT,
+ Type.BYTES_VAR_STRAIGHT, Type.BYTES_VAR_DEREF);
- private static EnumSet<ValueType> SORTED_BYTES = EnumSet.of(
- ValueType.BYTES_FIXED_SORTED, ValueType.BYTES_VAR_SORTED);
+ private static EnumSet<Type> SORTED_BYTES = EnumSet.of(
+ Type.BYTES_FIXED_SORTED, Type.BYTES_VAR_SORTED);
- public ValueType randomValueType(EnumSet<ValueType> typeEnum, Random random) {
- ValueType[] array = typeEnum.toArray(new ValueType[0]);
+ public Type randomValueType(EnumSet<Type> typeEnum, Random random) {
+ Type[] array = typeEnum.toArray(new Type[0]);
return array[random.nextInt(array.length)];
}
@@ -70,7 +72,7 @@ public class TestTypePromotion extends L
Int, Float, Byte
}
- private void runTest(EnumSet<ValueType> types, TestType type)
+ private void runTest(EnumSet<Type> types, TestType type)
throws CorruptIndexException, IOException {
Directory dir = newDirectory();
IndexWriter writer = new IndexWriter(dir,
@@ -79,11 +81,11 @@ public class TestTypePromotion extends L
int num_2 = atLeast(200);
int num_3 = atLeast(200);
long[] values = new long[num_1 + num_2 + num_3];
- index(writer, new IndexDocValuesField("promote"),
+ index(writer, new DocValuesField("promote"),
randomValueType(types, random), values, 0, num_1);
writer.commit();
- index(writer, new IndexDocValuesField("promote"),
+ index(writer, new DocValuesField("promote"),
randomValueType(types, random), values, num_1, num_2);
writer.commit();
@@ -94,7 +96,7 @@ public class TestTypePromotion extends L
Directory dir_2 = newDirectory() ;
IndexWriter writer_2 = new IndexWriter(dir_2,
newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random)));
- index(writer_2, new IndexDocValuesField("promote"),
+ index(writer_2, new DocValuesField("promote"),
randomValueType(types, random), values, num_1 + num_2, num_3);
writer_2.commit();
writer_2.close();
@@ -110,7 +112,7 @@ public class TestTypePromotion extends L
}
dir_2.close();
} else {
- index(writer, new IndexDocValuesField("promote"),
+ index(writer, new DocValuesField("promote"),
randomValueType(types, random), values, num_1 + num_2, num_3);
}
@@ -127,7 +129,7 @@ public class TestTypePromotion extends L
assertEquals(1, reader.getSequentialSubReaders().length);
ReaderContext topReaderContext = reader.getTopReaderContext();
ReaderContext[] children = topReaderContext.children();
- IndexDocValues docValues = children[0].reader.docValues("promote");
+ DocValues docValues = children[0].reader.docValues("promote");
assertEquals(1, children.length);
Source directSource = docValues.getDirectSource();
for (int i = 0; i < values.length; i++) {
@@ -172,8 +174,8 @@ public class TestTypePromotion extends L
reader.close();
}
- public void index(IndexWriter writer, IndexDocValuesField valField,
- ValueType valueType, long[] values, int offset, int num)
+ public void index(IndexWriter writer, DocValuesField valField,
+ Type valueType, long[] values, int offset, int num)
throws CorruptIndexException, IOException {
BytesRef ref = new BytesRef(new byte[] { 1, 2, 3, 4 });
for (int i = offset; i < offset + num; i++) {
@@ -267,7 +269,7 @@ public class TestTypePromotion extends L
int num_1 = atLeast(200);
int num_2 = atLeast(200);
long[] values = new long[num_1 + num_2];
- index(writer, new IndexDocValuesField("promote"),
+ index(writer, new DocValuesField("promote"),
randomValueType(INTEGERS, random), values, 0, num_1);
writer.commit();
@@ -276,7 +278,7 @@ public class TestTypePromotion extends L
Directory dir_2 = newDirectory() ;
IndexWriter writer_2 = new IndexWriter(dir_2,
newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random)));
- index(writer_2, new IndexDocValuesField("promote"),
+ index(writer_2, new DocValuesField("promote"),
randomValueType(random.nextBoolean() ? UNSORTED_BYTES : SORTED_BYTES, random), values, num_1, num_2);
writer_2.commit();
writer_2.close();
@@ -290,7 +292,7 @@ public class TestTypePromotion extends L
}
dir_2.close();
} else {
- index(writer, new IndexDocValuesField("promote"),
+ index(writer, new DocValuesField("promote"),
randomValueType(random.nextBoolean() ? UNSORTED_BYTES : SORTED_BYTES, random), values, num_1, num_2);
writer.commit();
}
@@ -307,10 +309,10 @@ public class TestTypePromotion extends L
assertEquals(1, reader.getSequentialSubReaders().length);
ReaderContext topReaderContext = reader.getTopReaderContext();
ReaderContext[] children = topReaderContext.children();
- IndexDocValues docValues = children[0].reader.docValues("promote");
+ DocValues docValues = children[0].reader.docValues("promote");
assertNotNull(docValues);
assertValues(TestType.Byte, dir, values);
- assertEquals(ValueType.BYTES_VAR_STRAIGHT, docValues.type());
+ assertEquals(Type.BYTES_VAR_STRAIGHT, docValues.type());
reader.close();
dir.close();
}
Modified: lucene/dev/branches/lucene3622/lucene/src/test/org/apache/lucene/search/TestDocValuesScoring.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3622/lucene/src/test/org/apache/lucene/search/TestDocValuesScoring.java?rev=1212506&r1=1212505&r2=1212506&view=diff
==============================================================================
--- lucene/dev/branches/lucene3622/lucene/src/test/org/apache/lucene/search/TestDocValuesScoring.java (original)
+++ lucene/dev/branches/lucene3622/lucene/src/test/org/apache/lucene/search/TestDocValuesScoring.java Fri Dec 9 16:43:45 2011
@@ -21,15 +21,15 @@ import java.io.IOException;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
-import org.apache.lucene.document.IndexDocValuesField;
+import org.apache.lucene.document.DocValuesField;
import org.apache.lucene.document.TextField;
import org.apache.lucene.index.FieldInvertState;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.RandomIndexWriter;
import org.apache.lucene.index.Term;
+import org.apache.lucene.index.DocValues.Source;
import org.apache.lucene.index.IndexReader.AtomicReaderContext;
import org.apache.lucene.index.codecs.Codec;
-import org.apache.lucene.index.values.IndexDocValues.Source;
import org.apache.lucene.search.similarities.DefaultSimilarityProvider;
import org.apache.lucene.search.similarities.Similarity;
import org.apache.lucene.search.similarities.SimilarityProvider;
@@ -48,7 +48,7 @@ public class TestDocValuesScoring extend
private static final float SCORE_EPSILON = 0.001f; /* for comparing floats */
public void testSimple() throws Exception {
- assumeFalse("PreFlex codec cannot work with IndexDocValues!",
+ assumeFalse("PreFlex codec cannot work with DocValues!",
"Lucene3x".equals(Codec.getDefault().getName()));
Directory dir = newDirectory();
@@ -56,7 +56,7 @@ public class TestDocValuesScoring extend
Document doc = new Document();
Field field = newField("foo", "", TextField.TYPE_UNSTORED);
doc.add(field);
- IndexDocValuesField dvField = new IndexDocValuesField("foo_boost");
+ DocValuesField dvField = new DocValuesField("foo_boost");
doc.add(dvField);
Field field2 = newField("bar", "", TextField.TYPE_UNSTORED);
doc.add(field2);
Modified: lucene/dev/branches/lucene3622/lucene/src/test/org/apache/lucene/search/TestSort.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3622/lucene/src/test/org/apache/lucene/search/TestSort.java?rev=1212506&r1=1212505&r2=1212506&view=diff
==============================================================================
--- lucene/dev/branches/lucene3622/lucene/src/test/org/apache/lucene/search/TestSort.java (original)
+++ lucene/dev/branches/lucene3622/lucene/src/test/org/apache/lucene/search/TestSort.java Fri Dec 9 16:43:45 2011
@@ -28,7 +28,7 @@ import org.apache.lucene.analysis.MockAn
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
import org.apache.lucene.document.FieldType;
-import org.apache.lucene.document.IndexDocValuesField;
+import org.apache.lucene.document.DocValuesField;
import org.apache.lucene.document.StringField;
import org.apache.lucene.document.TextField;
import org.apache.lucene.index.CorruptIndexException;
@@ -42,7 +42,7 @@ import org.apache.lucene.index.RandomInd
import org.apache.lucene.index.SlowMultiReaderWrapper;
import org.apache.lucene.index.Term;
import org.apache.lucene.index.codecs.Codec;
-import org.apache.lucene.index.values.ValueType;
+import org.apache.lucene.index.DocValues;
import org.apache.lucene.search.BooleanClause.Occur;
import org.apache.lucene.search.FieldValueHitQueue.Entry;
import org.apache.lucene.store.Directory;
@@ -121,18 +121,18 @@ public class TestSort extends LuceneTest
dirs.add(indexStore);
RandomIndexWriter writer = new RandomIndexWriter(random, indexStore, newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random)).setMergePolicy(newLogMergePolicy()));
- final ValueType stringDVType;
+ final DocValues.Type stringDVType;
if (dvStringSorted) {
// Index sorted
- stringDVType = random.nextBoolean() ? ValueType.BYTES_VAR_SORTED : ValueType.BYTES_FIXED_SORTED;
+ stringDVType = random.nextBoolean() ? DocValues.Type.BYTES_VAR_SORTED : DocValues.Type.BYTES_FIXED_SORTED;
} else {
// Index non-sorted
if (random.nextBoolean()) {
// Fixed
- stringDVType = random.nextBoolean() ? ValueType.BYTES_FIXED_STRAIGHT : ValueType.BYTES_FIXED_DEREF;
+ stringDVType = random.nextBoolean() ? DocValues.Type.BYTES_FIXED_STRAIGHT : DocValues.Type.BYTES_FIXED_DEREF;
} else {
// Var
- stringDVType = random.nextBoolean() ? ValueType.BYTES_VAR_STRAIGHT : ValueType.BYTES_VAR_DEREF;
+ stringDVType = random.nextBoolean() ? DocValues.Type.BYTES_VAR_STRAIGHT : DocValues.Type.BYTES_VAR_DEREF;
}
}
@@ -148,21 +148,21 @@ public class TestSort extends LuceneTest
if (data[i][2] != null) {
Field f = new StringField ("int", data[i][2]);
if (supportsDocValues) {
- f = IndexDocValuesField.build(f, ValueType.VAR_INTS);
+ f = DocValuesField.build(f, DocValues.Type.VAR_INTS);
}
doc.add(f);
}
if (data[i][3] != null) {
Field f = new StringField ("float", data[i][3]);
if (supportsDocValues) {
- f = IndexDocValuesField.build(f, ValueType.FLOAT_32);
+ f = DocValuesField.build(f, DocValues.Type.FLOAT_32);
}
doc.add(f);
}
if (data[i][4] != null) {
Field f = new StringField ("string", data[i][4]);
if (supportsDocValues) {
- f = IndexDocValuesField.build(f, stringDVType);
+ f = DocValuesField.build(f, stringDVType);
}
doc.add(f);
}
@@ -172,7 +172,7 @@ public class TestSort extends LuceneTest
if (data[i][8] != null) {
Field f = new StringField ("double", data[i][8]);
if (supportsDocValues) {
- f = IndexDocValuesField.build(f, ValueType.FLOAT_64);
+ f = DocValuesField.build(f, DocValues.Type.FLOAT_64);
}
doc.add(f);
}
@@ -219,13 +219,13 @@ public class TestSort extends LuceneTest
//doc.add (new Field ("contents", Integer.toString(i), Field.Store.NO, Field.Index.ANALYZED));
Field f = new StringField("string", num);
if (supportsDocValues) {
- f = IndexDocValuesField.build(f, ValueType.BYTES_VAR_SORTED);
+ f = DocValuesField.build(f, DocValues.Type.BYTES_VAR_SORTED);
}
doc.add (f);
String num2 = getRandomCharString(getRandomNumber(1, 4), 48, 50);
f = new StringField ("string2", num2);
if (supportsDocValues) {
- f = IndexDocValuesField.build(f, ValueType.BYTES_VAR_SORTED);
+ f = DocValuesField.build(f, DocValues.Type.BYTES_VAR_SORTED);
}
doc.add (f);
doc.add (new Field ("tracer2", num2, onlyStored));
@@ -238,13 +238,13 @@ public class TestSort extends LuceneTest
//doc.add (new Field ("contents", Integer.toString(i), Field.Store.NO, Field.Index.ANALYZED));
f = new StringField("string_fixed", numFixed);
if (supportsDocValues) {
- f = IndexDocValuesField.build(f, ValueType.BYTES_FIXED_SORTED);
+ f = DocValuesField.build(f, DocValues.Type.BYTES_FIXED_SORTED);
}
doc.add (f);
String num2Fixed = getRandomCharString(fixedLen2, 48, 52);
f = new StringField ("string2_fixed", num2Fixed);
if (supportsDocValues) {
- f = IndexDocValuesField.build(f, ValueType.BYTES_FIXED_SORTED);
+ f = DocValuesField.build(f, DocValues.Type.BYTES_FIXED_SORTED);
}
doc.add (f);
doc.add (new Field ("tracer2_fixed", num2Fixed, onlyStored));
Modified: lucene/dev/branches/lucene3622/modules/grouping/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3622/modules/grouping/CHANGES.txt?rev=1212506&r1=1212505&r2=1212506&view=diff
==============================================================================
--- lucene/dev/branches/lucene3622/modules/grouping/CHANGES.txt (original)
+++ lucene/dev/branches/lucene3622/modules/grouping/CHANGES.txt Fri Dec 9 16:43:45 2011
@@ -17,4 +17,4 @@ LUCENE-3483: Move Function grouping coll
New features
-LUCENE-3496: Support grouping by IndexDocValues. (Martijn van Groningen)
\ No newline at end of file
+LUCENE-3496: Support grouping by DocValues. (Martijn van Groningen)
\ No newline at end of file
Modified: lucene/dev/branches/lucene3622/modules/grouping/src/java/org/apache/lucene/search/grouping/dv/DVAllGroupHeadsCollector.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3622/modules/grouping/src/java/org/apache/lucene/search/grouping/dv/DVAllGroupHeadsCollector.java?rev=1212506&r1=1212505&r2=1212506&view=diff
==============================================================================
--- lucene/dev/branches/lucene3622/modules/grouping/src/java/org/apache/lucene/search/grouping/dv/DVAllGroupHeadsCollector.java (original)
+++ lucene/dev/branches/lucene3622/modules/grouping/src/java/org/apache/lucene/search/grouping/dv/DVAllGroupHeadsCollector.java Fri Dec 9 16:43:45 2011
@@ -17,9 +17,9 @@ package org.apache.lucene.search.groupin
* limitations under the License.
*/
+import org.apache.lucene.index.DocValues;
+import org.apache.lucene.index.DocValues.Type; // javadocs
import org.apache.lucene.index.IndexReader;
-import org.apache.lucene.index.values.IndexDocValues;
-import org.apache.lucene.index.values.ValueType;
import org.apache.lucene.search.*;
import org.apache.lucene.search.grouping.AbstractAllGroupHeadsCollector;
import org.apache.lucene.util.BytesRef;
@@ -40,13 +40,13 @@ public abstract class DVAllGroupHeadsCol
final String groupField;
final boolean diskResident;
- final ValueType valueType;
+ final DocValues.Type valueType;
final BytesRef scratchBytesRef = new BytesRef();
IndexReader.AtomicReaderContext readerContext;
Scorer scorer;
- DVAllGroupHeadsCollector(String groupField, ValueType valueType, int numberOfSorts, boolean diskResident) {
+ DVAllGroupHeadsCollector(String groupField, DocValues.Type valueType, int numberOfSorts, boolean diskResident) {
super(numberOfSorts);
this.groupField = groupField;
this.valueType = valueType;
@@ -59,12 +59,12 @@ public abstract class DVAllGroupHeadsCol
*
* @param groupField The field to group by
* @param sortWithinGroup The sort within each group
- * @param type The {@link ValueType} which is used to select a concrete implementation.
+ * @param type The {@link Type} which is used to select a concrete implementation.
* @param diskResident Whether the values to group by should be disk resident
* @return an <code>AbstractAllGroupHeadsCollector</code> instance based on the supplied arguments
* @throws IOException If I/O related errors occur
*/
- public static AbstractAllGroupHeadsCollector create(String groupField, Sort sortWithinGroup, ValueType type, boolean diskResident) throws IOException {
+ public static AbstractAllGroupHeadsCollector create(String groupField, Sort sortWithinGroup, DocValues.Type type, boolean diskResident) throws IOException {
switch (type) {
case VAR_INTS:
case FIXED_INTS_8:
@@ -126,8 +126,8 @@ public abstract class DVAllGroupHeadsCol
public void setNextReader(IndexReader.AtomicReaderContext readerContext) throws IOException {
this.readerContext = readerContext;
- final IndexDocValues dv = readerContext.reader.docValues(groupField);
- final IndexDocValues.Source dvSource;
+ final DocValues dv = readerContext.reader.docValues(groupField);
+ final DocValues.Source dvSource;
if (dv != null) {
dvSource = diskResident ? dv.getDirectSource() : dv.getSource();
} else {
@@ -141,14 +141,14 @@ public abstract class DVAllGroupHeadsCol
*
* @param source The idv source to be used by concrete implementations
*/
- protected abstract void setDocValuesSources(IndexDocValues.Source source);
+ protected abstract void setDocValuesSources(DocValues.Source source);
/**
* @return The default source when no doc values are available.
* @param readerContext The current reader context
*/
- protected IndexDocValues.Source getDefaultSource(IndexReader.AtomicReaderContext readerContext) {
- return IndexDocValues.getDefaultSource(valueType);
+ protected DocValues.Source getDefaultSource(IndexReader.AtomicReaderContext readerContext) {
+ return DocValues.getDefaultSource(valueType);
}
// A general impl that works for any group sort.
@@ -157,7 +157,7 @@ public abstract class DVAllGroupHeadsCol
private final Sort sortWithinGroup;
private final Map<Comparable, GroupHead> groups;
- GeneralAllGroupHeadsCollector(String groupField, ValueType valueType, Sort sortWithinGroup, boolean diskResident) throws IOException {
+ GeneralAllGroupHeadsCollector(String groupField, DocValues.Type valueType, Sort sortWithinGroup, boolean diskResident) throws IOException {
super(groupField, valueType, sortWithinGroup.getSort().length, diskResident);
this.sortWithinGroup = sortWithinGroup;
groups = new HashMap<Comparable, GroupHead>();
@@ -211,9 +211,9 @@ public abstract class DVAllGroupHeadsCol
static class SortedBR extends GeneralAllGroupHeadsCollector {
- private IndexDocValues.SortedSource source;
+ private DocValues.SortedSource source;
- SortedBR(String groupField, ValueType valueType, Sort sortWithinGroup, boolean diskResident) throws IOException {
+ SortedBR(String groupField, DocValues.Type valueType, Sort sortWithinGroup, boolean diskResident) throws IOException {
super(groupField, valueType, sortWithinGroup, diskResident);
}
@@ -225,21 +225,21 @@ public abstract class DVAllGroupHeadsCol
return BytesRef.deepCopyOf((BytesRef) value);
}
- protected void setDocValuesSources(IndexDocValues.Source source) {
+ protected void setDocValuesSources(DocValues.Source source) {
this.source = source.asSortedSource();
}
@Override
- protected IndexDocValues.Source getDefaultSource(IndexReader.AtomicReaderContext readerContext) {
- return IndexDocValues.getDefaultSortedSource(valueType, readerContext.reader.maxDoc());
+ protected DocValues.Source getDefaultSource(IndexReader.AtomicReaderContext readerContext) {
+ return DocValues.getDefaultSortedSource(valueType, readerContext.reader.maxDoc());
}
}
static class BR extends GeneralAllGroupHeadsCollector {
- private IndexDocValues.Source source;
+ private DocValues.Source source;
- BR(String groupField, ValueType valueType, Sort sortWithinGroup, boolean diskResident) throws IOException {
+ BR(String groupField, DocValues.Type valueType, Sort sortWithinGroup, boolean diskResident) throws IOException {
super(groupField, valueType, sortWithinGroup, diskResident);
}
@@ -251,7 +251,7 @@ public abstract class DVAllGroupHeadsCol
return BytesRef.deepCopyOf((BytesRef) value);
}
- protected void setDocValuesSources(IndexDocValues.Source source) {
+ protected void setDocValuesSources(DocValues.Source source) {
this.source = source;
}
@@ -259,9 +259,9 @@ public abstract class DVAllGroupHeadsCol
static class Lng extends GeneralAllGroupHeadsCollector {
- private IndexDocValues.Source source;
+ private DocValues.Source source;
- Lng(String groupField, ValueType valueType, Sort sortWithinGroup, boolean diskResident) throws IOException {
+ Lng(String groupField, DocValues.Type valueType, Sort sortWithinGroup, boolean diskResident) throws IOException {
super(groupField, valueType, sortWithinGroup, diskResident);
}
@@ -273,16 +273,16 @@ public abstract class DVAllGroupHeadsCol
return value;
}
- protected void setDocValuesSources(IndexDocValues.Source source) {
+ protected void setDocValuesSources(DocValues.Source source) {
this.source = source;
}
}
static class Dbl extends GeneralAllGroupHeadsCollector {
- private IndexDocValues.Source source;
+ private DocValues.Source source;
- Dbl(String groupField, ValueType valueType, Sort sortWithinGroup, boolean diskResident) throws IOException {
+ Dbl(String groupField, DocValues.Type valueType, Sort sortWithinGroup, boolean diskResident) throws IOException {
super(groupField, valueType, sortWithinGroup, diskResident);
}
@@ -294,7 +294,7 @@ public abstract class DVAllGroupHeadsCol
return value;
}
- protected void setDocValuesSources(IndexDocValues.Source source) {
+ protected void setDocValuesSources(DocValues.Source source) {
this.source = source;
}
Modified: lucene/dev/branches/lucene3622/modules/grouping/src/java/org/apache/lucene/search/grouping/dv/DVAllGroupsCollector.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3622/modules/grouping/src/java/org/apache/lucene/search/grouping/dv/DVAllGroupsCollector.java?rev=1212506&r1=1212505&r2=1212506&view=diff
==============================================================================
--- lucene/dev/branches/lucene3622/modules/grouping/src/java/org/apache/lucene/search/grouping/dv/DVAllGroupsCollector.java (original)
+++ lucene/dev/branches/lucene3622/modules/grouping/src/java/org/apache/lucene/search/grouping/dv/DVAllGroupsCollector.java Fri Dec 9 16:43:45 2011
@@ -17,9 +17,9 @@ package org.apache.lucene.search.groupin
* limitations under the License.
*/
+import org.apache.lucene.index.DocValues;
+import org.apache.lucene.index.DocValues.Type; // javadocs
import org.apache.lucene.index.IndexReader;
-import org.apache.lucene.index.values.IndexDocValues;
-import org.apache.lucene.index.values.ValueType;
import org.apache.lucene.search.grouping.AbstractAllGroupsCollector;
import org.apache.lucene.search.grouping.SentinelIntSet;
import org.apache.lucene.util.BytesRef;
@@ -29,7 +29,7 @@ import java.util.*;
/**
* Implementation of {@link AbstractAllGroupsCollector} that groups documents based on
- * {@link IndexDocValues} fields.
+ * {@link DocValues} fields.
*
* @lucene.experimental
*/
@@ -39,20 +39,20 @@ public abstract class DVAllGroupsCollect
/**
* Expert: Constructs a {@link DVAllGroupsCollector}.
- * Selects and constructs the most optimal all groups collector implementation for grouping by {@link IndexDocValues}.
+ * Selects and constructs the most optimal all groups collector implementation for grouping by {@link DocValues}.
*
*
* @param groupField The field to group by
- * @param type The {@link ValueType} which is used to select a concrete implementation.
+ * @param type The {@link Type} which is used to select a concrete implementation.
* @param diskResident Whether the values to group by should be disk resident
* @param initialSize The initial allocation size of the
* internal int set and group list
* which should roughly match the total
* number of expected unique groups. Be aware that the
* heap usage is 4 bytes * initialSize. Not all concrete implementions use this!
- * @return the most optimal all groups collector implementation for grouping by {@link IndexDocValues}
+ * @return the most optimal all groups collector implementation for grouping by {@link DocValues}
*/
- public static DVAllGroupsCollector create(String groupField, ValueType type, boolean diskResident, int initialSize) {
+ public static DVAllGroupsCollector create(String groupField, DocValues.Type type, boolean diskResident, int initialSize) {
switch (type) {
case VAR_INTS:
case FIXED_INTS_8:
@@ -78,25 +78,25 @@ public abstract class DVAllGroupsCollect
/**
* Constructs a {@link DVAllGroupsCollector}.
- * Selects and constructs the most optimal all groups collector implementation for grouping by {@link IndexDocValues}.
+ * Selects and constructs the most optimal all groups collector implementation for grouping by {@link DocValues}.
* If implementations require an initial allocation size then this will be set to 128.
*
*
* @param groupField The field to group by
- * @param type The {@link ValueType} which is used to select a concrete implementation.
+ * @param type The {@link Type} which is used to select a concrete implementation.
* @param diskResident Wether the values to group by should be disk resident
- * @return the most optimal all groups collector implementation for grouping by {@link IndexDocValues}
+ * @return the most optimal all groups collector implementation for grouping by {@link DocValues}
*/
- public static DVAllGroupsCollector create(String groupField, ValueType type, boolean diskResident) {
+ public static DVAllGroupsCollector create(String groupField, DocValues.Type type, boolean diskResident) {
return create(groupField, type, diskResident, DEFAULT_INITIAL_SIZE);
}
final String groupField;
- final ValueType valueType;
+ final DocValues.Type valueType;
final boolean diskResident;
final Collection<GROUP_VALUE_TYPE> groups;
- DVAllGroupsCollector(String groupField, ValueType valueType, boolean diskResident, Collection<GROUP_VALUE_TYPE> groups) {
+ DVAllGroupsCollector(String groupField, DocValues.Type valueType, boolean diskResident, Collection<GROUP_VALUE_TYPE> groups) {
this.groupField = groupField;
this.valueType = valueType;
this.diskResident = diskResident;
@@ -105,8 +105,8 @@ public abstract class DVAllGroupsCollect
@Override
public void setNextReader(IndexReader.AtomicReaderContext readerContext) throws IOException {
- final IndexDocValues dv = readerContext.reader.docValues(groupField);
- final IndexDocValues.Source dvSource;
+ final DocValues dv = readerContext.reader.docValues(groupField);
+ final DocValues.Source dvSource;
if (dv != null) {
dvSource = diskResident ? dv.getDirectSource() : dv.getSource();
} else {
@@ -121,21 +121,21 @@ public abstract class DVAllGroupsCollect
* @param source The idv source to be used by concrete implementations
* @param readerContext The current reader context
*/
- protected abstract void setDocValuesSources(IndexDocValues.Source source, IndexReader.AtomicReaderContext readerContext);
+ protected abstract void setDocValuesSources(DocValues.Source source, IndexReader.AtomicReaderContext readerContext);
/**
* @return The default source when no doc values are available.
* @param readerContext The current reader context
*/
- protected IndexDocValues.Source getDefaultSource(IndexReader.AtomicReaderContext readerContext) {
- return IndexDocValues.getDefaultSource(valueType);
+ protected DocValues.Source getDefaultSource(IndexReader.AtomicReaderContext readerContext) {
+ return DocValues.getDefaultSource(valueType);
}
static class Lng extends DVAllGroupsCollector<Long> {
- private IndexDocValues.Source source;
+ private DocValues.Source source;
- Lng(String groupField, ValueType valueType, boolean diskResident) {
+ Lng(String groupField, DocValues.Type valueType, boolean diskResident) {
super(groupField, valueType, diskResident, new TreeSet<Long>());
}
@@ -150,7 +150,7 @@ public abstract class DVAllGroupsCollect
return groups;
}
- protected void setDocValuesSources(IndexDocValues.Source source, IndexReader.AtomicReaderContext readerContext) {
+ protected void setDocValuesSources(DocValues.Source source, IndexReader.AtomicReaderContext readerContext) {
this.source = source;
}
@@ -158,9 +158,9 @@ public abstract class DVAllGroupsCollect
static class Dbl extends DVAllGroupsCollector<Double> {
- private IndexDocValues.Source source;
+ private DocValues.Source source;
- Dbl(String groupField, ValueType valueType, boolean diskResident) {
+ Dbl(String groupField, DocValues.Type valueType, boolean diskResident) {
super(groupField, valueType, diskResident, new TreeSet<Double>());
}
@@ -175,7 +175,7 @@ public abstract class DVAllGroupsCollect
return groups;
}
- protected void setDocValuesSources(IndexDocValues.Source source, IndexReader.AtomicReaderContext readerContext) {
+ protected void setDocValuesSources(DocValues.Source source, IndexReader.AtomicReaderContext readerContext) {
this.source = source;
}
@@ -185,9 +185,9 @@ public abstract class DVAllGroupsCollect
private final BytesRef spare = new BytesRef();
- private IndexDocValues.Source source;
+ private DocValues.Source source;
- BR(String groupField, ValueType valueType, boolean diskResident) {
+ BR(String groupField, DocValues.Type valueType, boolean diskResident) {
super(groupField, valueType, diskResident, new TreeSet<BytesRef>());
}
@@ -202,7 +202,7 @@ public abstract class DVAllGroupsCollect
return groups;
}
- protected void setDocValuesSources(IndexDocValues.Source source, IndexReader.AtomicReaderContext readerContext) {
+ protected void setDocValuesSources(DocValues.Source source, IndexReader.AtomicReaderContext readerContext) {
this.source = source;
}
@@ -213,9 +213,9 @@ public abstract class DVAllGroupsCollect
private final SentinelIntSet ordSet;
private final BytesRef spare = new BytesRef();
- private IndexDocValues.SortedSource source;
+ private DocValues.SortedSource source;
- SortedBR(String groupField, ValueType valueType, boolean diskResident, int initialSize) {
+ SortedBR(String groupField, DocValues.Type valueType, boolean diskResident, int initialSize) {
super(groupField, valueType, diskResident, new ArrayList<BytesRef>(initialSize));
ordSet = new SentinelIntSet(initialSize, -1);
}
@@ -233,7 +233,7 @@ public abstract class DVAllGroupsCollect
return groups;
}
- protected void setDocValuesSources(IndexDocValues.Source source, IndexReader.AtomicReaderContext readerContext) {
+ protected void setDocValuesSources(DocValues.Source source, IndexReader.AtomicReaderContext readerContext) {
this.source = source.asSortedSource();
ordSet.clear();
@@ -246,8 +246,8 @@ public abstract class DVAllGroupsCollect
}
@Override
- protected IndexDocValues.Source getDefaultSource(IndexReader.AtomicReaderContext readerContext) {
- return IndexDocValues.getDefaultSortedSource(valueType, readerContext.reader.maxDoc());
+ protected DocValues.Source getDefaultSource(IndexReader.AtomicReaderContext readerContext) {
+ return DocValues.getDefaultSortedSource(valueType, readerContext.reader.maxDoc());
}
}
Modified: lucene/dev/branches/lucene3622/modules/grouping/src/java/org/apache/lucene/search/grouping/dv/DVFirstPassGroupingCollector.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3622/modules/grouping/src/java/org/apache/lucene/search/grouping/dv/DVFirstPassGroupingCollector.java?rev=1212506&r1=1212505&r2=1212506&view=diff
==============================================================================
--- lucene/dev/branches/lucene3622/modules/grouping/src/java/org/apache/lucene/search/grouping/dv/DVFirstPassGroupingCollector.java (original)
+++ lucene/dev/branches/lucene3622/modules/grouping/src/java/org/apache/lucene/search/grouping/dv/DVFirstPassGroupingCollector.java Fri Dec 9 16:43:45 2011
@@ -17,9 +17,9 @@ package org.apache.lucene.search.groupin
* limitations under the License.
*/
+import org.apache.lucene.index.DocValues;
+import org.apache.lucene.index.DocValues.Type; // javadocs
import org.apache.lucene.index.IndexReader;
-import org.apache.lucene.index.values.IndexDocValues;
-import org.apache.lucene.index.values.ValueType;
import org.apache.lucene.search.Sort;
import org.apache.lucene.search.grouping.AbstractFirstPassGroupingCollector;
import org.apache.lucene.util.BytesRef;
@@ -35,9 +35,9 @@ public abstract class DVFirstPassGroupin
final String groupField;
final boolean diskResident;
- final ValueType valueType;
+ final DocValues.Type valueType;
- public static DVFirstPassGroupingCollector create(Sort groupSort, int topNGroups, String groupField, ValueType type, boolean diskResident) throws IOException {
+ public static DVFirstPassGroupingCollector create(Sort groupSort, int topNGroups, String groupField, DocValues.Type type, boolean diskResident) throws IOException {
switch (type) {
case VAR_INTS:
case FIXED_INTS_8:
@@ -61,7 +61,7 @@ public abstract class DVFirstPassGroupin
}
}
- DVFirstPassGroupingCollector(Sort groupSort, int topNGroups, String groupField, boolean diskResident, ValueType valueType) throws IOException {
+ DVFirstPassGroupingCollector(Sort groupSort, int topNGroups, String groupField, boolean diskResident, DocValues.Type valueType) throws IOException {
super(groupSort, topNGroups);
this.groupField = groupField;
this.diskResident = diskResident;
@@ -72,8 +72,8 @@ public abstract class DVFirstPassGroupin
public void setNextReader(IndexReader.AtomicReaderContext readerContext) throws IOException {
super.setNextReader(readerContext);
- final IndexDocValues dv = readerContext.reader.docValues(groupField);
- final IndexDocValues.Source dvSource;
+ final DocValues dv = readerContext.reader.docValues(groupField);
+ final DocValues.Source dvSource;
if (dv != null) {
dvSource = diskResident ? dv.getDirectSource() : dv.getSource();
} else {
@@ -87,21 +87,21 @@ public abstract class DVFirstPassGroupin
*
* @param source The idv source to be used by concrete implementations
*/
- protected abstract void setDocValuesSources(IndexDocValues.Source source);
+ protected abstract void setDocValuesSources(DocValues.Source source);
/**
* @return The default source when no doc values are available.
* @param readerContext The current reader context
*/
- protected IndexDocValues.Source getDefaultSource(IndexReader.AtomicReaderContext readerContext) {
- return IndexDocValues.getDefaultSource(valueType);
+ protected DocValues.Source getDefaultSource(IndexReader.AtomicReaderContext readerContext) {
+ return DocValues.getDefaultSource(valueType);
}
static class Lng extends DVFirstPassGroupingCollector<Long> {
- private IndexDocValues.Source source;
+ private DocValues.Source source;
- Lng(Sort groupSort, int topNGroups, String groupField, boolean diskResident, ValueType type) throws IOException {
+ Lng(Sort groupSort, int topNGroups, String groupField, boolean diskResident, DocValues.Type type) throws IOException {
super(groupSort, topNGroups, groupField, diskResident, type);
}
@@ -113,16 +113,16 @@ public abstract class DVFirstPassGroupin
return groupValue;
}
- protected void setDocValuesSources(IndexDocValues.Source source) {
+ protected void setDocValuesSources(DocValues.Source source) {
this.source = source;
}
}
static class Dbl extends DVFirstPassGroupingCollector<Double> {
- private IndexDocValues.Source source;
+ private DocValues.Source source;
- Dbl(Sort groupSort, int topNGroups, String groupField, boolean diskResident, ValueType type) throws IOException {
+ Dbl(Sort groupSort, int topNGroups, String groupField, boolean diskResident, DocValues.Type type) throws IOException {
super(groupSort, topNGroups, groupField, diskResident, type);
}
@@ -134,17 +134,17 @@ public abstract class DVFirstPassGroupin
return groupValue;
}
- protected void setDocValuesSources(IndexDocValues.Source source) {
+ protected void setDocValuesSources(DocValues.Source source) {
this.source = source;
}
}
static class BR extends DVFirstPassGroupingCollector<BytesRef> {
- private IndexDocValues.Source source;
+ private DocValues.Source source;
private final BytesRef spare = new BytesRef();
- BR(Sort groupSort, int topNGroups, String groupField, boolean diskResident, ValueType type) throws IOException {
+ BR(Sort groupSort, int topNGroups, String groupField, boolean diskResident, DocValues.Type type) throws IOException {
super(groupSort, topNGroups, groupField, diskResident, type);
}
@@ -162,17 +162,17 @@ public abstract class DVFirstPassGroupin
}
@Override
- protected void setDocValuesSources(IndexDocValues.Source source) {
+ protected void setDocValuesSources(DocValues.Source source) {
this.source = source;
}
}
static class SortedBR extends DVFirstPassGroupingCollector<BytesRef> {
- private IndexDocValues.SortedSource sortedSource;
+ private DocValues.SortedSource sortedSource;
private final BytesRef spare = new BytesRef();
- SortedBR(Sort groupSort, int topNGroups, String groupField, boolean diskResident, ValueType type) throws IOException {
+ SortedBR(Sort groupSort, int topNGroups, String groupField, boolean diskResident, DocValues.Type type) throws IOException {
super(groupSort, topNGroups, groupField, diskResident, type);
}
@@ -192,13 +192,13 @@ public abstract class DVFirstPassGroupin
}
@Override
- protected void setDocValuesSources(IndexDocValues.Source source) {
+ protected void setDocValuesSources(DocValues.Source source) {
this.sortedSource = source.asSortedSource();
}
@Override
- protected IndexDocValues.Source getDefaultSource(IndexReader.AtomicReaderContext readerContext) {
- return IndexDocValues.getDefaultSortedSource(valueType, readerContext.reader.maxDoc());
+ protected DocValues.Source getDefaultSource(IndexReader.AtomicReaderContext readerContext) {
+ return DocValues.getDefaultSortedSource(valueType, readerContext.reader.maxDoc());
}
}
Modified: lucene/dev/branches/lucene3622/modules/grouping/src/java/org/apache/lucene/search/grouping/dv/DVSecondPassGroupingCollector.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3622/modules/grouping/src/java/org/apache/lucene/search/grouping/dv/DVSecondPassGroupingCollector.java?rev=1212506&r1=1212505&r2=1212506&view=diff
==============================================================================
--- lucene/dev/branches/lucene3622/modules/grouping/src/java/org/apache/lucene/search/grouping/dv/DVSecondPassGroupingCollector.java (original)
+++ lucene/dev/branches/lucene3622/modules/grouping/src/java/org/apache/lucene/search/grouping/dv/DVSecondPassGroupingCollector.java Fri Dec 9 16:43:45 2011
@@ -17,9 +17,9 @@ package org.apache.lucene.search.groupin
* limitations under the License.
*/
+import org.apache.lucene.index.DocValues;
+import org.apache.lucene.index.DocValues.Type; // javadocs
import org.apache.lucene.index.IndexReader;
-import org.apache.lucene.index.values.IndexDocValues;
-import org.apache.lucene.index.values.ValueType;
import org.apache.lucene.search.Sort;
import org.apache.lucene.search.grouping.AbstractSecondPassGroupingCollector;
import org.apache.lucene.search.grouping.SearchGroup;
@@ -38,11 +38,11 @@ public abstract class DVSecondPassGroupi
/**
* Constructs a {@link DVSecondPassGroupingCollector}.
- * Selects and constructs the most optimal second pass collector implementation for grouping by {@link IndexDocValues}.
+ * Selects and constructs the most optimal second pass collector implementation for grouping by {@link DocValues}.
*
* @param groupField The field to group by
* @param diskResident Whether the values to group by should be disk resident
- * @param type The {@link org.apache.lucene.index.values.ValueType} which is used to select a concrete implementation.
+ * @param type The {@link Type} which is used to select a concrete implementation.
* @param searchGroups The groups from the first phase search
* @param groupSort The sort used for the groups
* @param withinGroupSort The sort used for documents inside a group
@@ -50,13 +50,13 @@ public abstract class DVSecondPassGroupi
* @param getScores Whether to include scores for the documents inside a group
* @param getMaxScores Whether to keep track of the higest score per group
* @param fillSortFields Whether to include the sort values
- * @return the most optimal second pass collector implementation for grouping by {@link IndexDocValues}
+ * @return the most optimal second pass collector implementation for grouping by {@link DocValues}
* @throws IOException If I/O related errors occur
*/
@SuppressWarnings("unchecked")
public static DVSecondPassGroupingCollector create(String groupField,
boolean diskResident,
- ValueType type,
+ DocValues.Type type,
Collection<SearchGroup> searchGroups,
Sort groupSort,
Sort withinGroupSort,
@@ -92,10 +92,10 @@ public abstract class DVSecondPassGroupi
}
final String groupField;
- final ValueType valueType;
+ final DocValues.Type valueType;
final boolean diskResident;
- DVSecondPassGroupingCollector(String groupField, ValueType valueType, boolean diskResident, Collection<SearchGroup<GROUP_VALUE>> searchGroups, Sort groupSort, Sort withinGroupSort, int maxDocsPerGroup, boolean getScores, boolean getMaxScores, boolean fillSortFields) throws IOException {
+ DVSecondPassGroupingCollector(String groupField, DocValues.Type valueType, boolean diskResident, Collection<SearchGroup<GROUP_VALUE>> searchGroups, Sort groupSort, Sort withinGroupSort, int maxDocsPerGroup, boolean getScores, boolean getMaxScores, boolean fillSortFields) throws IOException {
super(searchGroups, groupSort, withinGroupSort, maxDocsPerGroup, getScores, getMaxScores, fillSortFields);
this.groupField = groupField;
this.valueType = valueType;
@@ -106,8 +106,8 @@ public abstract class DVSecondPassGroupi
public void setNextReader(IndexReader.AtomicReaderContext readerContext) throws IOException {
super.setNextReader(readerContext);
- final IndexDocValues dv = readerContext.reader.docValues(groupField);
- final IndexDocValues.Source dvSource;
+ final DocValues dv = readerContext.reader.docValues(groupField);
+ final DocValues.Source dvSource;
if (dv != null) {
dvSource = diskResident ? dv.getDirectSource() : dv.getSource();
} else {
@@ -122,21 +122,21 @@ public abstract class DVSecondPassGroupi
* @param source The idv source to be used by concrete implementations
* @param readerContext The current reader context
*/
- protected abstract void setDocValuesSources(IndexDocValues.Source source, IndexReader.AtomicReaderContext readerContext);
+ protected abstract void setDocValuesSources(DocValues.Source source, IndexReader.AtomicReaderContext readerContext);
/**
* @return The default source when no doc values are available.
* @param readerContext The current reader context
*/
- protected IndexDocValues.Source getDefaultSource(IndexReader.AtomicReaderContext readerContext) {
- return IndexDocValues.getDefaultSource(valueType);
+ protected DocValues.Source getDefaultSource(IndexReader.AtomicReaderContext readerContext) {
+ return DocValues.getDefaultSource(valueType);
}
static class Lng extends DVSecondPassGroupingCollector<Long> {
- private IndexDocValues.Source source;
+ private DocValues.Source source;
- Lng(String groupField, ValueType valueType, boolean diskResident, Collection<SearchGroup<Long>> searchGroups, Sort groupSort, Sort withinGroupSort, int maxDocsPerGroup, boolean getScores, boolean getMaxScores, boolean fillSortFields) throws IOException {
+ Lng(String groupField, DocValues.Type valueType, boolean diskResident, Collection<SearchGroup<Long>> searchGroups, Sort groupSort, Sort withinGroupSort, int maxDocsPerGroup, boolean getScores, boolean getMaxScores, boolean fillSortFields) throws IOException {
super(groupField, valueType, diskResident, searchGroups, groupSort, withinGroupSort, maxDocsPerGroup, getScores, getMaxScores, fillSortFields);
}
@@ -144,16 +144,16 @@ public abstract class DVSecondPassGroupi
return groupMap.get(source.getInt(doc));
}
- protected void setDocValuesSources(IndexDocValues.Source source, IndexReader.AtomicReaderContext readerContext) {
+ protected void setDocValuesSources(DocValues.Source source, IndexReader.AtomicReaderContext readerContext) {
this.source = source;
}
}
static class Dbl extends DVSecondPassGroupingCollector<Double> {
- private IndexDocValues.Source source;
+ private DocValues.Source source;
- Dbl(String groupField, ValueType valueType, boolean diskResident, Collection<SearchGroup<Double>> searchGroups, Sort groupSort, Sort withinGroupSort, int maxDocsPerGroup, boolean getScores, boolean getMaxScores, boolean fillSortFields) throws IOException {
+ Dbl(String groupField, DocValues.Type valueType, boolean diskResident, Collection<SearchGroup<Double>> searchGroups, Sort groupSort, Sort withinGroupSort, int maxDocsPerGroup, boolean getScores, boolean getMaxScores, boolean fillSortFields) throws IOException {
super(groupField, valueType, diskResident, searchGroups, groupSort, withinGroupSort, maxDocsPerGroup, getScores, getMaxScores, fillSortFields);
}
@@ -161,17 +161,17 @@ public abstract class DVSecondPassGroupi
return groupMap.get(source.getFloat(doc));
}
- protected void setDocValuesSources(IndexDocValues.Source source, IndexReader.AtomicReaderContext readerContext) {
+ protected void setDocValuesSources(DocValues.Source source, IndexReader.AtomicReaderContext readerContext) {
this.source = source;
}
}
static class BR extends DVSecondPassGroupingCollector<BytesRef> {
- private IndexDocValues.Source source;
+ private DocValues.Source source;
private final BytesRef spare = new BytesRef();
- BR(String groupField, ValueType valueType, boolean diskResident, Collection<SearchGroup<BytesRef>> searchGroups, Sort groupSort, Sort withinGroupSort, int maxDocsPerGroup, boolean getScores, boolean getMaxScores, boolean fillSortFields) throws IOException {
+ BR(String groupField, DocValues.Type valueType, boolean diskResident, Collection<SearchGroup<BytesRef>> searchGroups, Sort groupSort, Sort withinGroupSort, int maxDocsPerGroup, boolean getScores, boolean getMaxScores, boolean fillSortFields) throws IOException {
super(groupField, valueType, diskResident, searchGroups, groupSort, withinGroupSort, maxDocsPerGroup, getScores, getMaxScores, fillSortFields);
}
@@ -180,7 +180,7 @@ public abstract class DVSecondPassGroupi
}
@Override
- protected void setDocValuesSources(IndexDocValues.Source source, IndexReader.AtomicReaderContext readerContext) {
+ protected void setDocValuesSources(DocValues.Source source, IndexReader.AtomicReaderContext readerContext) {
this.source = source;
}
@@ -188,12 +188,12 @@ public abstract class DVSecondPassGroupi
static class SortedBR extends DVSecondPassGroupingCollector<BytesRef> {
- private IndexDocValues.SortedSource source;
+ private DocValues.SortedSource source;
private final BytesRef spare = new BytesRef();
private final SentinelIntSet ordSet;
@SuppressWarnings("unchecked")
- SortedBR(String groupField, ValueType valueType, boolean diskResident, Collection<SearchGroup<BytesRef>> searchGroups, Sort groupSort, Sort withinGroupSort, int maxDocsPerGroup, boolean getScores, boolean getMaxScores, boolean fillSortFields) throws IOException {
+ SortedBR(String groupField, DocValues.Type valueType, boolean diskResident, Collection<SearchGroup<BytesRef>> searchGroups, Sort groupSort, Sort withinGroupSort, int maxDocsPerGroup, boolean getScores, boolean getMaxScores, boolean fillSortFields) throws IOException {
super(groupField, valueType, diskResident, searchGroups, groupSort, withinGroupSort, maxDocsPerGroup, getScores, getMaxScores, fillSortFields);
ordSet = new SentinelIntSet(groupMap.size(), -1);
groupDocs = (SearchGroupDocs<BytesRef>[]) new SearchGroupDocs[ordSet.keys.length];
@@ -209,7 +209,7 @@ public abstract class DVSecondPassGroupi
}
@Override
- protected void setDocValuesSources(IndexDocValues.Source source, IndexReader.AtomicReaderContext readerContext) {
+ protected void setDocValuesSources(DocValues.Source source, IndexReader.AtomicReaderContext readerContext) {
this.source = source.asSortedSource();
ordSet.clear();
@@ -222,8 +222,8 @@ public abstract class DVSecondPassGroupi
}
@Override
- protected IndexDocValues.Source getDefaultSource(IndexReader.AtomicReaderContext readerContext) {
- return IndexDocValues.getDefaultSortedSource(valueType, readerContext.reader.maxDoc());
+ protected DocValues.Source getDefaultSource(IndexReader.AtomicReaderContext readerContext) {
+ return DocValues.getDefaultSortedSource(valueType, readerContext.reader.maxDoc());
}
}
Modified: lucene/dev/branches/lucene3622/modules/grouping/src/java/org/apache/lucene/search/grouping/package.html
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3622/modules/grouping/src/java/org/apache/lucene/search/grouping/package.html?rev=1212506&r1=1212505&r2=1212506&view=diff
==============================================================================
--- lucene/dev/branches/lucene3622/modules/grouping/src/java/org/apache/lucene/search/grouping/package.html (original)
+++ lucene/dev/branches/lucene3622/modules/grouping/src/java/org/apache/lucene/search/grouping/package.html Fri Dec 9 16:43:45 2011
@@ -186,14 +186,14 @@ fields, <code>FieldCache</code>, etc.).
</p>
<p>
- There are also IndexDocValues based implementations available for the group collectors. There are factory methods
- available for creating idv based instances. A typical example using idv based grouping collectors:
+ There are also DocValues based implementations available for the group collectors. There are factory methods
+ available for creating dv based instances. A typical example using dv based grouping collectors:
</p>
<pre class="prettyprint">
boolean diskResident = true; // Whether values should fetched directly from disk by passing the Java heap space.
AbstractFirstPassGroupingCollector c1 = DVFirstPassGroupingCollector.create(
- groupSort, groupOffset+topNGroups, "author", ValueType.BYTES_VAR_SORTED, diskResident
+ groupSort, groupOffset+topNGroups, "author", DocValues.Type.BYTES_VAR_SORTED, diskResident
);
s.search(new TermQuery(new Term("content", searchTerm)), c1);
@@ -209,7 +209,7 @@ fields, <code>FieldCache</code>, etc.).
boolean getMaxScores = true;
boolean fillFields = true;
AbstractSecondPassGroupingCollector<BytesRef> c2 = DVSecondPassGroupingCollector.create(
- "author", diskResident, ValueType.BYTES_VAR_SORTED, topGroups, groupSort, docSort,
+ "author", diskResident, DocValues.Type.BYTES_VAR_SORTED, topGroups, groupSort, docSort,
docOffset+docsPerGroup, getScores, getMaxScores, fillFields
);