mirror of https://github.com/apache/lucene.git
add points to back compat indices
This commit is contained in:
parent
5def78ba10
commit
1e794e0ee2
|
@ -38,13 +38,18 @@ import java.util.regex.Pattern;
|
|||
import org.apache.lucene.analysis.MockAnalyzer;
|
||||
import org.apache.lucene.codecs.Codec;
|
||||
import org.apache.lucene.document.BinaryDocValuesField;
|
||||
import org.apache.lucene.document.BinaryPoint;
|
||||
import org.apache.lucene.document.Document;
|
||||
import org.apache.lucene.document.DoubleDocValuesField;
|
||||
import org.apache.lucene.document.DoublePoint;
|
||||
import org.apache.lucene.document.Field;
|
||||
import org.apache.lucene.document.FieldType;
|
||||
import org.apache.lucene.document.FloatDocValuesField;
|
||||
import org.apache.lucene.document.FloatPoint;
|
||||
import org.apache.lucene.document.IntPoint;
|
||||
import org.apache.lucene.document.LegacyIntField;
|
||||
import org.apache.lucene.document.LegacyLongField;
|
||||
import org.apache.lucene.document.LongPoint;
|
||||
import org.apache.lucene.document.NumericDocValuesField;
|
||||
import org.apache.lucene.document.SortedDocValuesField;
|
||||
import org.apache.lucene.document.SortedNumericDocValuesField;
|
||||
|
@ -700,6 +705,8 @@ public class TestBackwardsCompatibility extends LuceneTestCase {
|
|||
final boolean is42Index = MultiFields.getMergedFieldInfos(reader).fieldInfo("dvSortedSet") != null;
|
||||
// true if this is a 4.9+ index
|
||||
final boolean is49Index = MultiFields.getMergedFieldInfos(reader).fieldInfo("dvSortedNumeric") != null;
|
||||
// true if this index has points (>= 6.0)
|
||||
final boolean hasPoints = MultiFields.getMergedFieldInfos(reader).fieldInfo("intPoint1d") != null;
|
||||
|
||||
assert is40Index;
|
||||
|
||||
|
@ -831,6 +838,23 @@ public class TestBackwardsCompatibility extends LuceneTestCase {
|
|||
hits = searcher.search(new TermQuery(new Term("utf8", "ab\ud917\udc17cd")), 1000).scoreDocs;
|
||||
assertEquals(34, hits.length);
|
||||
|
||||
if (hasPoints) {
|
||||
doTestHits(searcher.search(IntPoint.newRangeQuery("intPoint1d", 0, 34), 1000).scoreDocs, 34, searcher.getIndexReader());
|
||||
doTestHits(searcher.search(IntPoint.newRangeQuery("intPoint2d", new int[] {0, 0}, new int[] {34, 68}), 1000).scoreDocs, 34, searcher.getIndexReader());
|
||||
doTestHits(searcher.search(FloatPoint.newRangeQuery("floatPoint1d", 0f, 34f), 1000).scoreDocs, 34, searcher.getIndexReader());
|
||||
doTestHits(searcher.search(FloatPoint.newRangeQuery("floatPoint2d", new float[] {0f, 0f}, new float[] {34f, 68f}), 1000).scoreDocs, 34, searcher.getIndexReader());
|
||||
doTestHits(searcher.search(LongPoint.newRangeQuery("longPoint1d", 0, 34), 1000).scoreDocs, 34, searcher.getIndexReader());
|
||||
doTestHits(searcher.search(LongPoint.newRangeQuery("longPoint2d", new long[] {0, 0}, new long[] {34, 68}), 1000).scoreDocs, 34, searcher.getIndexReader());
|
||||
doTestHits(searcher.search(DoublePoint.newRangeQuery("doublePoint1d", 0.0, 34.0), 1000).scoreDocs, 34, searcher.getIndexReader());
|
||||
doTestHits(searcher.search(DoublePoint.newRangeQuery("doublePoint2d", new double[] {0.0, 0.0}, new double[] {34.0, 68.0}), 1000).scoreDocs, 34, searcher.getIndexReader());
|
||||
|
||||
byte[] bytes1 = new byte[4];
|
||||
byte[] bytes2 = new byte[] {0, 0, 0, (byte) 34};
|
||||
doTestHits(searcher.search(BinaryPoint.newRangeQuery("binaryPoint1d", bytes1, bytes2), 1000).scoreDocs, 34, searcher.getIndexReader());
|
||||
byte[] bytes3 = new byte[] {0, 0, 0, (byte) 68};
|
||||
doTestHits(searcher.search(BinaryPoint.newRangeQuery("binaryPoint2d", new byte[][] {bytes1, bytes1}, new byte[][] {bytes2, bytes3}), 1000).scoreDocs, 34, searcher.getIndexReader());
|
||||
}
|
||||
|
||||
reader.close();
|
||||
}
|
||||
|
||||
|
@ -983,6 +1007,18 @@ public class TestBackwardsCompatibility extends LuceneTestCase {
|
|||
doc.add(new NumericDocValuesField("dvShort", (short)id));
|
||||
doc.add(new SortedSetDocValuesField("dvSortedSet", ref));
|
||||
doc.add(new SortedNumericDocValuesField("dvSortedNumeric", id));
|
||||
|
||||
doc.add(new IntPoint("intPoint1d", id));
|
||||
doc.add(new IntPoint("intPoint2d", id, 2*id));
|
||||
doc.add(new FloatPoint("floatPoint1d", (float) id));
|
||||
doc.add(new FloatPoint("floatPoint2d", (float) id, (float) 2*id));
|
||||
doc.add(new LongPoint("longPoint1d", id));
|
||||
doc.add(new LongPoint("longPoint2d", id, 2*id));
|
||||
doc.add(new DoublePoint("doublePoint1d", (double) id));
|
||||
doc.add(new DoublePoint("doublePoint2d", (double) id, (double) 2*id));
|
||||
doc.add(new BinaryPoint("binaryPoint1d", bytes));
|
||||
doc.add(new BinaryPoint("binaryPoint2d", bytes, bytes));
|
||||
|
||||
// a field with both offsets and term vectors for a cross-check
|
||||
FieldType customType3 = new FieldType(TextField.TYPE_STORED);
|
||||
customType3.setStoreTermVectors(true);
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue