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 2017/06/15 17:28:54 UTC

lucene-solr:branch_6x: SOLR-10891: Don't require docvalues on BBoxField

Repository: lucene-solr
Updated Branches:
  refs/heads/branch_6x 631e1d4b7 -> 85615c6ec


SOLR-10891: Don't require docvalues on BBoxField


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/85615c6e
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/85615c6e
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/85615c6e

Branch: refs/heads/branch_6x
Commit: 85615c6ecdb5ffb872f1d6599714295d0bebec21
Parents: 631e1d4
Author: Steve Rowe <sa...@apache.org>
Authored: Thu Jun 15 13:28:17 2017 -0400
Committer: Steve Rowe <sa...@apache.org>
Committed: Thu Jun 15 13:28:45 2017 -0400

----------------------------------------------------------------------
 .../src/java/org/apache/solr/schema/BBoxField.java  |  3 ---
 .../solr/collection1/conf/schema-spatial.xml        |  4 ++++
 .../org/apache/solr/search/TestSolr4Spatial.java    | 16 +++++++++++-----
 3 files changed, 15 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/85615c6e/solr/core/src/java/org/apache/solr/schema/BBoxField.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/schema/BBoxField.java b/solr/core/src/java/org/apache/solr/schema/BBoxField.java
index af462f9..079b9d5 100644
--- a/solr/core/src/java/org/apache/solr/schema/BBoxField.java
+++ b/solr/core/src/java/org/apache/solr/schema/BBoxField.java
@@ -91,9 +91,6 @@ public class BBoxField extends AbstractSpatialFieldType<BBoxStrategy> implements
     if (numberType.getNumberType() != NumberType.DOUBLE) {
       throw new RuntimeException("Must be Double number type: " + numberType);
     }
-    if ( ! numberType.hasProperty(DOC_VALUES)) {
-      throw new RuntimeException("Must have doc values: " + numberType);
-    }
 
     //note: this only works for explicit fields, not dynamic fields
     List<SchemaField> fields = new ArrayList<>(schema.getFields().values());//copy, because we modify during iteration

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/85615c6e/solr/core/src/test-files/solr/collection1/conf/schema-spatial.xml
----------------------------------------------------------------------
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.xml
index a90fa3d..6126e26 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
@@ -56,6 +56,9 @@
   <fieldType name="bbox" class="solr.BBoxField"
              numberType="tdoubleDV" distanceUnits="degrees" storeSubFields="false"/>
 
+  <fieldType name="bbox_ndv" class="solr.BBoxField"
+             numberType="tdouble" distanceUnits="degrees" storeSubFields="false" docValues="false"/>
+
   <fieldType name="pbbox" class="solr.BBoxField"
              numberType="pdouble" distanceUnits="degrees" storeSubFields="false"/>
 
@@ -71,6 +74,7 @@
   <field name="srptgeom" type="srptgeom"/>
   <field name="bbox" type="bbox"/>
   <field name="pbbox" type="pbbox"/>
+  <field name="bbox_ndv" type="bbox_ndv"/>
   <field name="llp" type="llp" indexed="true" docValues="true" />
   <field name="llp_idx" type="llp" indexed="true" docValues="false" />
   <field name="llp_dv" type="llp" indexed="false" docValues="true" />

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/85615c6e/solr/core/src/test/org/apache/solr/search/TestSolr4Spatial.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/search/TestSolr4Spatial.java b/solr/core/src/test/org/apache/solr/search/TestSolr4Spatial.java
index 993eb52..1a59b94 100644
--- a/solr/core/src/test/org/apache/solr/search/TestSolr4Spatial.java
+++ b/solr/core/src/test/org/apache/solr/search/TestSolr4Spatial.java
@@ -53,7 +53,7 @@ public class TestSolr4Spatial extends SolrTestCaseJ4 {
   @ParametersFactory
   public static Iterable<Object[]> parameters() {
     return Arrays.asList(new Object[][]{
-        {"llp"}, {"llp_idx"}, {"llp_dv"}, {"srpt_geohash"}, {"srpt_quad"}, {"srpt_packedquad"}, {"stqpt_geohash"}, {"pointvector"}, {"bbox"}, {"pbbox"}
+        {"llp"}, {"llp_idx"}, {"llp_dv"}, {"srpt_geohash"}, {"srpt_quad"}, {"srpt_packedquad"}, {"stqpt_geohash"}, {"pointvector"}, {"bbox"}, {"pbbox"}, {"bbox_ndv"}
     });
   }
 
@@ -178,8 +178,14 @@ public class TestSolr4Spatial extends SolrTestCaseJ4 {
     checkHits(fieldName, true, pt, distKM, sphereRadius, count, docIds);
   }
 
+  private boolean isBBoxField(String fieldName) {
+    return fieldName.equalsIgnoreCase("bbox") 
+        || fieldName.equalsIgnoreCase("pbbox")
+        || fieldName.equalsIgnoreCase("bbox_ndv"); 
+  }
+  
   private void checkHits(String fieldName, boolean exact, String ptStr, double distKM, double sphereRadius, int count, int ... docIds) throws ParseException {
-    if (exact && fieldName.equalsIgnoreCase("bbox") | fieldName.equalsIgnoreCase("pbbox")) {
+    if (exact && isBBoxField(fieldName)) {
       return; // bbox field only supports rectangular query
     }
     String [] tests = new String[docIds != null && docIds.length > 0 ? docIds.length + 1 : 1];
@@ -369,9 +375,9 @@ public class TestSolr4Spatial extends SolrTestCaseJ4 {
 
   private String radiusQuery(double lat, double lon, double dDEG, String score, String filter) {
     //Choose between the Solr/Geofilt syntax, and the Lucene spatial module syntax
-    if (fieldName.equals("bbox") || fieldName.equals("pbbox") || random().nextBoolean()) {
+    if (isBBoxField(fieldName) || random().nextBoolean()) {
       //we cheat for bbox strategy which doesn't do radius, only rect.
-      final String qparser = (fieldName.equals("bbox") || fieldName.equals("pbbox")) ? "bbox" : "geofilt";
+      final String qparser = isBBoxField(fieldName) ? "bbox" : "geofilt";
       return "{!" + qparser + " " +
           "sfield=" + fieldName + " "
           + (score != null ? "score="+score : "") + " "
@@ -389,7 +395,7 @@ public class TestSolr4Spatial extends SolrTestCaseJ4 {
   public void testSortMultiVal() throws Exception {
     assumeTrue("dist sorting not supported on field " + fieldName, canCalcDistance);
     assumeFalse("Multivalue not supported for this field",
-        fieldName.equals("pointvector") || fieldName.equals("bbox") || fieldName.equals("pbbox"));
+        fieldName.equals("pointvector") || isBBoxField(fieldName));
 
     assertU(adoc("id", "100", fieldName, "1,2"));//1 point
     assertU(adoc("id", "101", fieldName, "4,-1", fieldName, "3,5"));//2 points, 2nd is pretty close to query point