lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r...@apache.org
Subject svn commit: r1662354 - in /lucene/dev/branches/branch_5x/solr: CHANGES.txt core/src/java/org/apache/solr/schema/BBoxField.java core/src/test-files/solr/collection1/conf/schema-spatial.xml core/src/test/org/apache/solr/search/TestSolr4Spatial.java
Date Thu, 26 Feb 2015 04:35:18 GMT
Author: ryan
Date: Thu Feb 26 04:35:18 2015
New Revision: 1662354

URL: http://svn.apache.org/r1662354
Log:
SOLR-7164: BBoxFieldType defaults sub fields to not-stored

Modified:
    lucene/dev/branches/branch_5x/solr/CHANGES.txt
    lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/schema/BBoxField.java
    lucene/dev/branches/branch_5x/solr/core/src/test-files/solr/collection1/conf/schema-spatial.xml
    lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/search/TestSolr4Spatial.java

Modified: lucene/dev/branches/branch_5x/solr/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/CHANGES.txt?rev=1662354&r1=1662353&r2=1662354&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/CHANGES.txt (original)
+++ lucene/dev/branches/branch_5x/solr/CHANGES.txt Thu Feb 26 04:35:18 2015
@@ -69,6 +69,8 @@ New Features
 
 * SOLR-5507: Admin UI - Refactoring using AngularJS, first part (Upayavira via 
   Erick Erickson)
+  
+* SOLR-7164: BBoxFieldType defaults sub fields to not-stored (ryan)
 
 Bug Fixes
 ----------------------

Modified: lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/schema/BBoxField.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/schema/BBoxField.java?rev=1662354&r1=1662353&r2=1662354&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/schema/BBoxField.java
(original)
+++ lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/schema/BBoxField.java
Thu Feb 26 04:35:18 2015
@@ -44,6 +44,7 @@ public class BBoxField extends AbstractS
 
   private String numberTypeName;//required
   private String booleanTypeName = "boolean";
+  private boolean storeSubFields = false;
 
   private IndexSchema schema;
 
@@ -66,6 +67,11 @@ public class BBoxField extends AbstractS
     if (v != null) {
       booleanTypeName = v;
     }
+    
+    v = args.remove("storeSubFields");
+    if (v != null) {
+      storeSubFields = Boolean.valueOf(v);
+    }
   }
 
   @Override
@@ -108,7 +114,15 @@ public class BBoxField extends AbstractS
   // note: Registering the field is probably optional; it makes it show up in the schema
browser and may have other
   //  benefits.
   private void register(IndexSchema schema, String name, FieldType fieldType) {
-    SchemaField sf = new SchemaField(name, fieldType);
+    int props = fieldType.properties;
+    props &= ~MULTIVALUED; // must not be multivalued
+    if(storeSubFields) {
+      props |= STORED;
+    }
+    else {
+      props &= ~STORED;
+    }
+    SchemaField sf = new SchemaField(name, fieldType, props, null);
     schema.getFields().put(sf.getName(), sf);
   }
 

Modified: lucene/dev/branches/branch_5x/solr/core/src/test-files/solr/collection1/conf/schema-spatial.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/core/src/test-files/solr/collection1/conf/schema-spatial.xml?rev=1662354&r1=1662353&r2=1662354&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/core/src/test-files/solr/collection1/conf/schema-spatial.xml
(original)
+++ lucene/dev/branches/branch_5x/solr/core/src/test-files/solr/collection1/conf/schema-spatial.xml
Thu Feb 26 04:35:18 2015
@@ -48,7 +48,7 @@
                numberType="tdouble" distanceUnits="degrees"/>
 
     <fieldType name="bbox" class="solr.BBoxField"
-               numberType="tdoubleDV" distanceUnits="degrees"/>
+               numberType="tdoubleDV" distanceUnits="degrees" storeSubFields="false"/>
   </types>
 
 

Modified: lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/search/TestSolr4Spatial.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/search/TestSolr4Spatial.java?rev=1662354&r1=1662353&r2=1662354&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/search/TestSolr4Spatial.java
(original)
+++ lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/search/TestSolr4Spatial.java
Thu Feb 26 04:35:18 2015
@@ -26,8 +26,13 @@ import com.spatial4j.core.context.Spatia
 import com.spatial4j.core.distance.DistanceUtils;
 import com.spatial4j.core.shape.Point;
 import com.spatial4j.core.shape.Rectangle;
+
+import org.apache.lucene.spatial.bbox.BBoxStrategy;
 import org.apache.solr.SolrTestCaseJ4;
 import org.apache.solr.common.SolrException;
+import org.apache.solr.schema.BBoxField;
+import org.apache.solr.schema.IndexSchema;
+import org.apache.solr.schema.SchemaField;
 import org.apache.solr.util.SpatialUtils;
 import org.junit.Before;
 import org.junit.BeforeClass;
@@ -366,4 +371,16 @@ public class TestSolr4Spatial extends So
         SolrException.ErrorCode.BAD_REQUEST);
   }
 
+
+  @Test
+  public void testSpatialConfig() throws Exception {
+    IndexSchema schema = h.getCoreInc().getLatestSchema();
+
+    // BBox Config
+    // Make sure the subfields are not stored
+    SchemaField sub = schema.getField("bbox"+BBoxStrategy.SUFFIX_MINX);
+    assertFalse(sub.stored());
+    assertFalse(sub.multiValued());
+  }
+  
 }



Mime
View raw message