lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dsmi...@apache.org
Subject svn commit: r1388866 - in /lucene/dev/branches/branch_4x: ./ lucene/ lucene/spatial/ lucene/spatial/src/java/org/apache/lucene/spatial/prefix/tree/ solr/ solr/core/ solr/core/src/java/org/apache/solr/schema/ solr/core/src/test-files/solr/collection1/co...
Date Sat, 22 Sep 2012 18:32:50 GMT
Author: dsmiley
Date: Sat Sep 22 18:32:49 2012
New Revision: 1388866

URL: http://svn.apache.org/viewvc?rev=1388866&view=rev
Log:
SOLR-3864 maxDetailDist -> maxDistErr and make units='degrees' mandatory

Modified:
    lucene/dev/branches/branch_4x/   (props changed)
    lucene/dev/branches/branch_4x/lucene/   (props changed)
    lucene/dev/branches/branch_4x/lucene/spatial/   (props changed)
    lucene/dev/branches/branch_4x/lucene/spatial/src/java/org/apache/lucene/spatial/prefix/tree/SpatialPrefixTreeFactory.java
    lucene/dev/branches/branch_4x/solr/   (props changed)
    lucene/dev/branches/branch_4x/solr/core/   (props changed)
    lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/schema/AbstractSpatialFieldType.java
    lucene/dev/branches/branch_4x/solr/core/src/test-files/solr/collection1/conf/schema-spatial.xml
    lucene/dev/branches/branch_4x/solr/example/   (props changed)
    lucene/dev/branches/branch_4x/solr/example/solr/collection1/conf/schema.xml

Modified: lucene/dev/branches/branch_4x/lucene/spatial/src/java/org/apache/lucene/spatial/prefix/tree/SpatialPrefixTreeFactory.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/spatial/src/java/org/apache/lucene/spatial/prefix/tree/SpatialPrefixTreeFactory.java?rev=1388866&r1=1388865&r2=1388866&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/spatial/src/java/org/apache/lucene/spatial/prefix/tree/SpatialPrefixTreeFactory.java
(original)
+++ lucene/dev/branches/branch_4x/lucene/spatial/src/java/org/apache/lucene/spatial/prefix/tree/SpatialPrefixTreeFactory.java
Sat Sep 22 18:32:49 2012
@@ -31,6 +31,9 @@ import java.util.Map;
 public abstract class SpatialPrefixTreeFactory {
 
   private static final double DEFAULT_GEO_MAX_DETAIL_KM = 0.001;//1m
+  public static final String PREFIX_TREE = "prefixTree";
+  public static final String MAX_LEVELS = "maxLevels";
+  public static final String MAX_DIST_ERR = "maxDistErr";
 
   protected Map<String, String> args;
   protected SpatialContext ctx;
@@ -42,7 +45,7 @@ public abstract class SpatialPrefixTreeF
    */
   public static SpatialPrefixTree makeSPT(Map<String,String> args, ClassLoader classLoader,
SpatialContext ctx) {
     SpatialPrefixTreeFactory instance;
-    String cname = args.get("prefixTree");
+    String cname = args.get(PREFIX_TREE);
     if (cname == null)
       cname = ctx.isGeo() ? "geohash" : "quad";
     if ("geohash".equalsIgnoreCase(cname))
@@ -68,14 +71,14 @@ public abstract class SpatialPrefixTreeF
   }
 
   protected void initMaxLevels() {
-    String mlStr = args.get("maxLevels");
+    String mlStr = args.get(MAX_LEVELS);
     if (mlStr != null) {
       maxLevels = Integer.valueOf(mlStr);
       return;
     }
 
     double degrees;
-    String maxDetailDistStr = args.get("maxDetailDist");
+    String maxDetailDistStr = args.get(MAX_DIST_ERR);
     if (maxDetailDistStr == null) {
       if (!ctx.isGeo()) {
         return;//let default to max
@@ -83,9 +86,6 @@ public abstract class SpatialPrefixTreeF
       degrees = DistanceUtils.dist2Degrees(DEFAULT_GEO_MAX_DETAIL_KM, DistanceUtils.EARTH_MEAN_RADIUS_KM);
     } else {
       degrees = Double.parseDouble(maxDetailDistStr);
-      if (ctx.isGeo()) {
-        degrees = DistanceUtils.dist2Degrees(Double.parseDouble(maxDetailDistStr), DistanceUtils.EARTH_MEAN_RADIUS_KM);
-      }
     }
     maxLevels = getLevelForDistance(degrees);
   }

Modified: lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/schema/AbstractSpatialFieldType.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/schema/AbstractSpatialFieldType.java?rev=1388866&r1=1388865&r2=1388866&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/schema/AbstractSpatialFieldType.java
(original)
+++ lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/schema/AbstractSpatialFieldType.java
Sat Sep 22 18:32:49 2012
@@ -62,6 +62,11 @@ public abstract class AbstractSpatialFie
   protected void init(IndexSchema schema, Map<String, String> args) {
     super.init(schema, args);
 
+    String units = args.remove("units");
+    if (!"degrees".equals(units))
+      throw new SolrException(SolrException.ErrorCode.SERVER_ERROR,
+          "Must specify units=\"degrees\" on field types with class "+getClass().getSimpleName());
+
     //Solr expects us to remove the parameters we've used.
     MapListener<String, String> argsWrap = new MapListener<String, String>(args);
     ctx = SpatialContextFactory.makeSpatialContext(argsWrap, schema.getResourceLoader().getClassLoader());

Modified: lucene/dev/branches/branch_4x/solr/core/src/test-files/solr/collection1/conf/schema-spatial.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/test-files/solr/collection1/conf/schema-spatial.xml?rev=1388866&r1=1388865&r2=1388866&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/test-files/solr/collection1/conf/schema-spatial.xml
(original)
+++ lucene/dev/branches/branch_4x/solr/core/src/test-files/solr/collection1/conf/schema-spatial.xml
Sat Sep 22 18:32:49 2012
@@ -27,22 +27,22 @@
     <fieldType name="string" class="solr.StrField" sortMissingLast="true"/>
 
     <fieldType name="srpt_geohash"   class="solr.SpatialRecursivePrefixTreeFieldType"
-               prefixTree="geohash"
+               prefixTree="geohash" units="degrees"
         />
     <fieldType name="srpt_quad"   class="solr.SpatialRecursivePrefixTreeFieldType"
-              prefixTree="quad"
+              prefixTree="quad" units="degrees"
         />
     <fieldType name="srpt_100km"   class="solr.SpatialRecursivePrefixTreeFieldType"
-              maxDetailDist="0.9"
+              maxDistErr="0.9" units="degrees"
         />
     <fieldType name="stqpt_geohash"   class="solr.SpatialTermQueryPrefixTreeFieldType"
-              prefixTree="geohash" />
+              prefixTree="geohash" units="degrees" />
 
     <fieldType name="stqpt_u"  class="solr.SpatialTermQueryPrefixTreeFieldType"
-        geo="false" distCalculator="cartesian^2" worldBounds="0 0 1000 1000"/>
+        geo="false" distCalculator="cartesian^2" worldBounds="0 0 1000 1000" units="degrees"/>
 
     <fieldType name="twodoubles" class="solr.SpatialTwoDoublesFieldType"
-               numberType="tdouble"/>
+               numberType="tdouble" units="degrees"/>
 
   </types>
 

Modified: lucene/dev/branches/branch_4x/solr/example/solr/collection1/conf/schema.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/example/solr/collection1/conf/schema.xml?rev=1388866&r1=1388865&r2=1388866&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/example/solr/collection1/conf/schema.xml (original)
+++ lucene/dev/branches/branch_4x/solr/example/solr/collection1/conf/schema.xml Sat Sep 22
18:32:49 2012
@@ -686,7 +686,7 @@
       http://wiki.apache.org/solr/SolrAdaptersForLuceneSpatial4
     -->
     <fieldType name="location_rpt" class="solr.SpatialRecursivePrefixTreeFieldType"
-        geo="true" distErrPct="0.025" maxDetailDist="0.000009" />
+        geo="true" distErrPct="0.025" maxDistErr="0.000009" units="degrees" />
 
    <!-- Money/currency field type. See http://wiki.apache.org/solr/MoneyFieldType
         Parameters:



Mime
View raw message