Apache Solr open-source search software
LUCENE-4374 Rename TwoDoubles to PointVector
David Wayne Smileye9cffebf96fc
diff --git a/lucene/spatial/src/java/org/apache/lucene/spatial/vector/DistanceValueSource.java b/lucene/spatial/src/java/org/apache/lucene/spatial/vector/DistanceValueSource.javaindex cd2750d4eb0..7f61fda5eaa 100644--- a/lucene/spatial/src/java/org/apache/lucene/spatial/vector/DistanceValueSource.java+++ b/lucene/spatial/src/java/org/apache/lucene/spatial/vector/DistanceValueSource.java@@ -36,13 +36,13 @@ import java.util.Map;*/public class DistanceValueSource extends ValueSource {- private TwoDoublesStrategy strategy;+ private PointVectorStrategy strategy;private final Point from;/*** Constructor.*/- public DistanceValueSource(TwoDoublesStrategy strategy, Point from) {+ public DistanceValueSource(PointVectorStrategy strategy, Point from) {this.strategy = strategy;this.from = from;}diff --git a/lucene/spatial/src/java/org/apache/lucene/spatial/vector/TwoDoublesStrategy.java b/lucene/spatial/src/java/org/apache/lucene/spatial/vector/PointVectorStrategy.javasimilarity index 98%rename from lucene/spatial/src/java/org/apache/lucene/spatial/vector/TwoDoublesStrategy.javarename to lucene/spatial/src/java/org/apache/lucene/spatial/vector/PointVectorStrategy.javaindex 1a1fa648857..19b0721577a 100644--- a/lucene/spatial/src/java/org/apache/lucene/spatial/vector/TwoDoublesStrategy.java+++ b/lucene/spatial/src/java/org/apache/lucene/spatial/vector/PointVectorStrategy.java@@ -55,7 +55,7 @@ import org.apache.lucene.spatial.util.ValueSourceFilter;** @lucene.experimental*/-public class TwoDoublesStrategy extends SpatialStrategy {+public class PointVectorStrategy extends SpatialStrategy {public static final String SUFFIX_X = "__x";public static final String SUFFIX_Y = "__y";@@ -65,7 +65,7 @@ public class TwoDoublesStrategy extends SpatialStrategy {public int precisionStep = 8; // same as solr default- public TwoDoublesStrategy(SpatialContext ctx, String fieldNamePrefix) {+ public PointVectorStrategy(SpatialContext ctx, String fieldNamePrefix) {super(ctx, fieldNamePrefix);this.fieldNameX = fieldNamePrefix+SUFFIX_X;this.fieldNameY = fieldNamePrefix+SUFFIX_Y;diff --git a/lucene/spatial/src/test/org/apache/lucene/spatial/DistanceStrategyTest.java b/lucene/spatial/src/test/org/apache/lucene/spatial/DistanceStrategyTest.javaindex df7f446b2c7..5530ac7b6b1 100644--- a/lucene/spatial/src/test/org/apache/lucene/spatial/DistanceStrategyTest.java+++ b/lucene/spatial/src/test/org/apache/lucene/spatial/DistanceStrategyTest.java@@ -29,7 +29,7 @@ import org.apache.lucene.spatial.prefix.TermQueryPrefixTreeStrategy;import org.apache.lucene.spatial.prefix.tree.GeohashPrefixTree;import org.apache.lucene.spatial.prefix.tree.QuadPrefixTree;import org.apache.lucene.spatial.prefix.tree.SpatialPrefixTree;-import org.apache.lucene.spatial.vector.TwoDoublesStrategy;+import org.apache.lucene.spatial.vector.PointVectorStrategy;import org.junit.Test;import java.io.IOException;@@ -54,7 +54,7 @@ public class DistanceStrategyTest extends StrategyTestCase {strategy = new TermQueryPrefixTreeStrategy(grid, "termquery_geohash");ctorArgs.add(new Object[]{new Param(strategy)});- strategy = new TwoDoublesStrategy(ctx, "twodoubles");+ strategy = new PointVectorStrategy(ctx, "pointvector");ctorArgs.add(new Object[]{new Param(strategy)});strategy = new BBoxStrategy(ctx, "bbox");diff --git a/lucene/spatial/src/test/org/apache/lucene/spatial/PortedSolr3Test.java b/lucene/spatial/src/test/org/apache/lucene/spatial/PortedSolr3Test.javaindex ae39a1adee6..ea63b87cc21 100644--- a/lucene/spatial/src/test/org/apache/lucene/spatial/PortedSolr3Test.java+++ b/lucene/spatial/src/test/org/apache/lucene/spatial/PortedSolr3Test.java@@ -34,7 +34,7 @@ import org.apache.lucene.spatial.prefix.tree.QuadPrefixTree;import org.apache.lucene.spatial.prefix.tree.SpatialPrefixTree;import org.apache.lucene.spatial.query.SpatialArgs;import org.apache.lucene.spatial.query.SpatialOperation;-import org.apache.lucene.spatial.vector.TwoDoublesStrategy;+import org.apache.lucene.spatial.vector.PointVectorStrategy;import org.junit.Test;import java.io.IOException;@@ -68,7 +68,7 @@ public class PortedSolr3Test extends StrategyTestCase {strategy = new TermQueryPrefixTreeStrategy(grid, "termquery_geohash");ctorArgs.add(new Object[]{new Param(strategy)});- strategy = new TwoDoublesStrategy(ctx, "twodoubles");+ strategy = new PointVectorStrategy(ctx, "pointvector");ctorArgs.add(new Object[]{new Param(strategy)});return ctorArgs;diff --git a/lucene/spatial/src/test/org/apache/lucene/spatial/vector/TestTwoDoublesStrategy.java b/lucene/spatial/src/test/org/apache/lucene/spatial/vector/TestPointVectorStrategy.javasimilarity index 93%rename from lucene/spatial/src/test/org/apache/lucene/spatial/vector/TestTwoDoublesStrategy.javarename to lucene/spatial/src/test/org/apache/lucene/spatial/vector/TestPointVectorStrategy.javaindex 9f1fb5f68fc..e10fe7d583f 100644--- a/lucene/spatial/src/test/org/apache/lucene/spatial/vector/TestTwoDoublesStrategy.java+++ b/lucene/spatial/src/test/org/apache/lucene/spatial/vector/TestPointVectorStrategy.java@@ -30,14 +30,14 @@ import org.junit.Test;import java.io.IOException;-public class TestTwoDoublesStrategy extends StrategyTestCase {+public class TestPointVectorStrategy extends StrategyTestCase {@Before@Overridepublic void setUp() throws Exception {super.setUp();this.ctx = SpatialContext.GEO;- this.strategy = new TwoDoublesStrategy(ctx, getClass().getSimpleName());+ this.strategy = new PointVectorStrategy(ctx, getClass().getSimpleName());}@Testdiff --git a/lucene/tools/junit4/cached-timehints.txt b/lucene/tools/junit4/cached-timehints.txtindex 92e39c479c4..2e2e0148e16 100644--- a/lucene/tools/junit4/cached-timehints.txt+++ b/lucene/tools/junit4/cached-timehints.txt@@ -561,7 +561,7 @@ org.apache.lucene.spatial.prefix.TestRecursivePrefixTreeStrategy=3329,4032,3419,org.apache.lucene.spatial.prefix.TestSpatialPrefixField=36,285,194,52,200,213,199,280,201,233,195,81,202,289,209,35,249,225org.apache.lucene.spatial.prefix.TestTermQueryPrefixGridStrategy=381,94,60,568,93,81,60,98,77,94,262,506,127,82,82,422,84,108org.apache.lucene.spatial.prefix.tree.SpatialPrefixTreeTest=239,52,50,201,72,41,59,56,58,50,75,243,50,58,75,285,66,59-org.apache.lucene.spatial.vector.TestTwoDoublesStrategy=3717,3129,2399,2794,3135,3154,2813,3657,2500,3682,3621,3363,3430,2567,3481,2450,3663,3450+org.apache.lucene.spatial.vector.TestPointVectorStrategy=3717,3129,2399,2794,3135,3154,2813,3657,2500,3682,3621,3363,3430,2567,3481,2450,3663,3450org.apache.lucene.store.TestBufferedIndexInput=1663,1777,1692,2301,2365,1896,2247,3707,1837,2544,1663,1823,2109,2229,1991,2361,1768,2452org.apache.lucene.store.TestByteArrayDataInput=29,52,205,56,65,39,49,23,57,40,48,38,29,33,56,29,56,31org.apache.lucene.store.TestCopyBytes=265,380,414,338,340,339,428,647,315,399,291,232,398,468,730,1265,514,323diff --git a/solr/core/src/java/org/apache/solr/schema/SpatialTwoDoublesFieldType.java b/solr/core/src/java/org/apache/solr/schema/SpatialPointVectorFieldType.javasimilarity index 81%rename from solr/core/src/java/org/apache/solr/schema/SpatialTwoDoublesFieldType.javarename to solr/core/src/java/org/apache/solr/schema/SpatialPointVectorFieldType.javaindex 0db9b6ebdda..51a733fbe29 100644--- a/solr/core/src/java/org/apache/solr/schema/SpatialTwoDoublesFieldType.java+++ b/solr/core/src/java/org/apache/solr/schema/SpatialPointVectorFieldType.java@@ -17,14 +17,14 @@ package org.apache.solr.schema;* limitations under the License.*/-import org.apache.lucene.spatial.vector.TwoDoublesStrategy;+import org.apache.lucene.spatial.vector.PointVectorStrategy;import java.util.ArrayList;import java.util.List;import java.util.Map;-public class SpatialTwoDoublesFieldType extends AbstractSpatialFieldType<TwoDoublesStrategy> implements SchemaAware {+public class SpatialPointVectorFieldType extends AbstractSpatialFieldType<PointVectorStrategy> implements SchemaAware {protected String numberFieldName = "tdouble";//in example schema defaults to non-zero precision step -- a good choiceprivate int precisionStep;@@ -58,8 +58,8 @@ public class SpatialTwoDoublesFieldType extends AbstractSpatialFieldType<TwoDoubfor( SchemaField sf : schema.getFields().values() ) {if( sf.getType() == this ) {String name = sf.getName();- newFields.add(new SchemaField(name + TwoDoublesStrategy.SUFFIX_X, fieldType, p, null));- newFields.add(new SchemaField(name + TwoDoublesStrategy.SUFFIX_Y, fieldType, p, null));+ newFields.add(new SchemaField(name + PointVectorStrategy.SUFFIX_X, fieldType, p, null));+ newFields.add(new SchemaField(name + PointVectorStrategy.SUFFIX_Y, fieldType, p, null));}}for (SchemaField newField : newFields) {@@ -68,8 +68,8 @@ public class SpatialTwoDoublesFieldType extends AbstractSpatialFieldType<TwoDoub}@Override- protected TwoDoublesStrategy newSpatialStrategy(String fieldName) {- TwoDoublesStrategy strategy = new TwoDoublesStrategy(ctx, fieldName);+ protected PointVectorStrategy newSpatialStrategy(String fieldName) {+ PointVectorStrategy strategy = new PointVectorStrategy(ctx, fieldName);strategy.setPrecisionStep(precisionStep);return strategy;}diff --git a/solr/core/src/test-files/solr/collection1/conf/schema-spatial.xml b/solr/core/src/test-files/solr/collection1/conf/schema-spatial.xmlindex 266873b6004..440e3a71ae3 100644--- a/solr/core/src/test-files/solr/collection1/conf/schema-spatial.xml+++ b/solr/core/src/test-files/solr/collection1/conf/schema-spatial.xml@@ -41,7 +41,7 @@<fieldType name="stqpt_u" class="solr.SpatialTermQueryPrefixTreeFieldType"geo="false" distCalculator="cartesian^2" worldBounds="0 0 1000 1000" units="degrees"/>- <fieldType name="twodoubles" class="solr.SpatialTwoDoublesFieldType"+ <fieldType name="pointVector" class="solr.SpatialPointVectorFieldType"numberType="tdouble" units="degrees"/></types>@@ -54,7 +54,7 @@<field name="srpt_geohash" type="srpt_geohash" multiValued="true" /><field name="srpt_quad" type="srpt_quad" multiValued="true" /><field name="stqpt_geohash" type="stqpt_geohash" multiValued="true" />- <field name="twodoubles" type="twodoubles" />+ <field name="pointvector" type="pointvector" /></fields>diff --git a/solr/core/src/test/org/apache/solr/search/TestSolr4Spatial.java b/solr/core/src/test/org/apache/solr/search/TestSolr4Spatial.javaindex 69b5c75bc21..735611d5388 100644--- a/solr/core/src/test/org/apache/solr/search/TestSolr4Spatial.java+++ b/solr/core/src/test/org/apache/solr/search/TestSolr4Spatial.java@@ -43,7 +43,7 @@ public class TestSolr4Spatial extends SolrTestCaseJ4 {@ParametersFactorypublic static Iterable<Object[]> parameters() {return Arrays.asList(new Object[][]{- {"srpt_geohash"}, {"srpt_quad"}, {"stqpt_geohash"}, {"twodoubles"}+ {"srpt_geohash"}, {"srpt_quad"}, {"stqpt_geohash"}, {"pointvector"}});}@@ -262,7 +262,7 @@ public class TestSolr4Spatial extends SolrTestCaseJ4 {@Testpublic void testSortMultiVal() throws Exception {- RandomizedTest.assumeFalse("Multivalue not supported for this field", fieldName.equals("twodoubles"));+ RandomizedTest.assumeFalse("Multivalue not supported for this field", fieldName.equals("pointvector"));assertU(adoc("id", "100", fieldName, "1,2"));//1 pointassertU(adoc("id", "101", fieldName, "4,-1", fieldName, "3,5"));//2 points, 2nd is pretty close to query point