You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by gs...@apache.org on 2010/12/02 18:10:28 UTC
svn commit: r1041464 - in /lucene/dev/branches/branch_3x/solr/src:
java/org/apache/solr/search/SpatialFilterQParser.java
test/org/apache/solr/search/SpatialFilterTest.java
Author: gsingers
Date: Thu Dec 2 17:10:27 2010
New Revision: 1041464
URL: http://svn.apache.org/viewvc?rev=1041464&view=rev
Log:
Merged from trunk
javadoc fix [from revision 996961]
remove todo [from revision 999378]
SOLR-2125: add a fine grained distance test [from revision 1001010]
Modified:
lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/search/SpatialFilterQParser.java
lucene/dev/branches/branch_3x/solr/src/test/org/apache/solr/search/SpatialFilterTest.java
Modified: lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/search/SpatialFilterQParser.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/search/SpatialFilterQParser.java?rev=1041464&r1=1041463&r2=1041464&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/search/SpatialFilterQParser.java (original)
+++ lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/search/SpatialFilterQParser.java Thu Dec 2 17:10:27 2010
@@ -27,7 +27,6 @@ import org.apache.solr.common.params.Sol
import org.apache.solr.common.params.SpatialParams;
import org.apache.solr.request.SolrQueryRequest;
import org.apache.solr.schema.FieldType;
-import org.apache.solr.schema.IndexSchema;
import org.apache.solr.schema.SchemaField;
import org.apache.solr.schema.SpatialQueryable;
@@ -36,8 +35,9 @@ import org.apache.solr.schema.SpatialQue
/**
* Creates a spatial Filter based on the type of spatial point used.
* <p/>
- * The field must implement XXXX
+ * The field must implement {@link org.apache.solr.schema.SpatialQueryable}
* <p/>
+ * All units are in Kilometers
* <p/>
* <p/>
* Syntax:
@@ -48,9 +48,9 @@ import org.apache.solr.schema.SpatialQue
* <li>fl - The fields to filter on. Must implement XXXX. Required. If more than one, XXXX</li>
* <li>pt - The point to use as a reference. Must match the dimension of the field. Required.</li>
* <li>d - The distance in the units specified. Required.</li>
- * <li>units - The units of the distance. K - kilometers, M - Miles. Optional. Default is miles.</li>
* <li>meas - The distance measure to use. Default is Euclidean (2-norm). If a number between 0-INF is used, then the Vector Distance is used. hsin = Haversine, sqe = Squared Euclidean</li>
- * </ul>
+ * </ul> *
+ *
*/
public class SpatialFilterQParser extends QParser {
Modified: lucene/dev/branches/branch_3x/solr/src/test/org/apache/solr/search/SpatialFilterTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/src/test/org/apache/solr/search/SpatialFilterTest.java?rev=1041464&r1=1041463&r2=1041464&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/solr/src/test/org/apache/solr/search/SpatialFilterTest.java (original)
+++ lucene/dev/branches/branch_3x/solr/src/test/org/apache/solr/search/SpatialFilterTest.java Thu Dec 2 17:10:27 2010
@@ -20,7 +20,6 @@ package org.apache.solr.search;
import org.apache.solr.SolrTestCaseJ4;
import org.junit.BeforeClass;
import org.junit.Test;
-import static org.junit.Assert.assertTrue;
/**
@@ -104,6 +103,7 @@ public class SpatialFilterTest extends S
assertU(adoc("id", "15", fieldName, "0,15"));
//3000KM from 0,0, see http://www.movable-type.co.uk/scripts/latlong.html
assertU(adoc("id", "16", fieldName, "18.71111,19.79750"));
+ assertU(adoc("id", "17", fieldName, "44.043900,-95.436643"));
assertU(commit());
checkHits(fieldName, "0,0", 1000, 1, 14);
@@ -111,6 +111,9 @@ public class SpatialFilterTest extends S
checkHits(fieldName, "0,0", 3000, 3, 14, 15, 16);
checkHits(fieldName, "0,0", 3001, 3, 14, 15, 16);
checkHits(fieldName, "0,0", 3000.1, 3, 14, 15, 16);
+ //really fine grained distance and reflects some of the vagaries of how we are calculating the box
+ checkHits(fieldName, "43.517030,-96.789603", 109, 0);
+ checkHits(fieldName, "43.517030,-96.789603", 110, 1, 17);
}
private void checkHits(String fieldName, String pt, double distance, int count, int ... docIds) {