lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r...@apache.org
Subject svn commit: r1662355 - in /lucene/dev/trunk: ./ solr/ solr/core/ solr/core/src/java/org/apache/solr/schema/ solr/core/src/test-files/solr/collection1/conf/ solr/core/src/test/org/apache/solr/search/
Date Thu, 26 Feb 2015 04:38:36 GMT
Author: ryan
Date: Thu Feb 26 04:38:36 2015
New Revision: 1662355

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

Modified:
    lucene/dev/trunk/   (props changed)
    lucene/dev/trunk/solr/   (props changed)
    lucene/dev/trunk/solr/CHANGES.txt   (contents, props changed)
    lucene/dev/trunk/solr/core/   (props changed)
    lucene/dev/trunk/solr/core/src/java/org/apache/solr/schema/BBoxField.java
    lucene/dev/trunk/solr/core/src/test-files/solr/collection1/conf/schema-spatial.xml
    lucene/dev/trunk/solr/core/src/test/org/apache/solr/search/TestSolr4Spatial.java

Modified: lucene/dev/trunk/solr/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/CHANGES.txt?rev=1662355&r1=1662354&r2=1662355&view=diff
==============================================================================
--- lucene/dev/trunk/solr/CHANGES.txt (original)
+++ lucene/dev/trunk/solr/CHANGES.txt Thu Feb 26 04:38:36 2015
@@ -117,6 +117,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/trunk/solr/core/src/java/org/apache/solr/schema/BBoxField.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/java/org/apache/solr/schema/BBoxField.java?rev=1662355&r1=1662354&r2=1662355&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/java/org/apache/solr/schema/BBoxField.java (original)
+++ lucene/dev/trunk/solr/core/src/java/org/apache/solr/schema/BBoxField.java Thu Feb 26 04:38:36
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/trunk/solr/core/src/test-files/solr/collection1/conf/schema-spatial.xml
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/test-files/solr/collection1/conf/schema-spatial.xml?rev=1662355&r1=1662354&r2=1662355&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/test-files/solr/collection1/conf/schema-spatial.xml (original)
+++ lucene/dev/trunk/solr/core/src/test-files/solr/collection1/conf/schema-spatial.xml Thu
Feb 26 04:38:36 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/trunk/solr/core/src/test/org/apache/solr/search/TestSolr4Spatial.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/test/org/apache/solr/search/TestSolr4Spatial.java?rev=1662355&r1=1662354&r2=1662355&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/test/org/apache/solr/search/TestSolr4Spatial.java (original)
+++ lucene/dev/trunk/solr/core/src/test/org/apache/solr/search/TestSolr4Spatial.java Thu Feb
26 04:38:36 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