You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by sa...@apache.org on 2016/07/21 13:37:28 UTC
[06/51] [abbrv] lucene-solr:apiv2: add points to back compat indices
add points to back compat indices
Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/1e794e0e
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/1e794e0e
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/1e794e0e
Branch: refs/heads/apiv2
Commit: 1e794e0ee26d17bdd8669a77592bbafaf758af18
Parents: 5def78b
Author: Mike McCandless <mi...@apache.org>
Authored: Tue Jul 12 10:07:49 2016 -0400
Committer: Mike McCandless <mi...@apache.org>
Committed: Tue Jul 12 10:14:24 2016 -0400
----------------------------------------------------------------------
.../index/TestBackwardsCompatibility.java | 36 +++++++++++++++++++
.../org/apache/lucene/index/index.6.0.0-cfs.zip | Bin 13744 -> 15807 bytes
.../apache/lucene/index/index.6.0.0-nocfs.zip | Bin 13749 -> 15806 bytes
.../org/apache/lucene/index/index.6.0.1-cfs.zip | Bin 13734 -> 15820 bytes
.../apache/lucene/index/index.6.0.1-nocfs.zip | Bin 13735 -> 15823 bytes
5 files changed, 36 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/1e794e0e/lucene/backward-codecs/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java
----------------------------------------------------------------------
diff --git a/lucene/backward-codecs/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java b/lucene/backward-codecs/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java
index 11096e4..8226022 100644
--- a/lucene/backward-codecs/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java
+++ b/lucene/backward-codecs/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java
@@ -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);
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/1e794e0e/lucene/backward-codecs/src/test/org/apache/lucene/index/index.6.0.0-cfs.zip
----------------------------------------------------------------------
diff --git a/lucene/backward-codecs/src/test/org/apache/lucene/index/index.6.0.0-cfs.zip b/lucene/backward-codecs/src/test/org/apache/lucene/index/index.6.0.0-cfs.zip
index 2993970..c8622df 100644
Binary files a/lucene/backward-codecs/src/test/org/apache/lucene/index/index.6.0.0-cfs.zip and b/lucene/backward-codecs/src/test/org/apache/lucene/index/index.6.0.0-cfs.zip differ
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/1e794e0e/lucene/backward-codecs/src/test/org/apache/lucene/index/index.6.0.0-nocfs.zip
----------------------------------------------------------------------
diff --git a/lucene/backward-codecs/src/test/org/apache/lucene/index/index.6.0.0-nocfs.zip b/lucene/backward-codecs/src/test/org/apache/lucene/index/index.6.0.0-nocfs.zip
index 55b5cc1..3c245d1 100644
Binary files a/lucene/backward-codecs/src/test/org/apache/lucene/index/index.6.0.0-nocfs.zip and b/lucene/backward-codecs/src/test/org/apache/lucene/index/index.6.0.0-nocfs.zip differ
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/1e794e0e/lucene/backward-codecs/src/test/org/apache/lucene/index/index.6.0.1-cfs.zip
----------------------------------------------------------------------
diff --git a/lucene/backward-codecs/src/test/org/apache/lucene/index/index.6.0.1-cfs.zip b/lucene/backward-codecs/src/test/org/apache/lucene/index/index.6.0.1-cfs.zip
index 4b8161f..f10f1a8 100644
Binary files a/lucene/backward-codecs/src/test/org/apache/lucene/index/index.6.0.1-cfs.zip and b/lucene/backward-codecs/src/test/org/apache/lucene/index/index.6.0.1-cfs.zip differ
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/1e794e0e/lucene/backward-codecs/src/test/org/apache/lucene/index/index.6.0.1-nocfs.zip
----------------------------------------------------------------------
diff --git a/lucene/backward-codecs/src/test/org/apache/lucene/index/index.6.0.1-nocfs.zip b/lucene/backward-codecs/src/test/org/apache/lucene/index/index.6.0.1-nocfs.zip
index 051b0ad..d45b7fd 100644
Binary files a/lucene/backward-codecs/src/test/org/apache/lucene/index/index.6.0.1-nocfs.zip and b/lucene/backward-codecs/src/test/org/apache/lucene/index/index.6.0.1-nocfs.zip differ