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 17:47:15 UTC
svn commit: r1041443 - in /lucene/dev/branches/branch_3x/solr:
example/solr/conf/schema.xml src/java/org/apache/solr/schema/LatLonType.java
Author: gsingers
Date: Thu Dec 2 16:47:15 2010
New Revision: 1041443
URL: http://svn.apache.org/viewvc?rev=1041443&view=rev
Log:
Merged from trunk
solr example: use trie on latlon for faster range queries [from revision 999139]
solr example: _latlon name was misleading - it's not a latlon, it's a single coordinate in a latlon [from revision 999152]
solr spatial: use the radius passed (including units) instead of hard-coding to miles [from revision 999175]
solr example: doc that latlon type can't be multivalued [from revision 999483]
fix typo in build.xml [from revision 999984]
SOLR-2128: full param substitution for function queries [from revision 1000000]
Modified:
lucene/dev/branches/branch_3x/solr/example/solr/conf/schema.xml
lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/schema/LatLonType.java
Modified: lucene/dev/branches/branch_3x/solr/example/solr/conf/schema.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/example/solr/conf/schema.xml?rev=1041443&r1=1041442&r2=1041443&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/solr/example/solr/conf/schema.xml (original)
+++ lucene/dev/branches/branch_3x/solr/example/solr/conf/schema.xml Thu Dec 2 16:47:15 2010
@@ -413,8 +413,8 @@
-->
<fieldType name="point" class="solr.PointType" dimension="2" subFieldSuffix="_d"/>
- <!-- A specialized field for spatial search. -->
- <fieldType name="location" class="solr.LatLonType" subFieldSuffix="_latlon"/>
+ <!-- A specialized field for geospatial search. If indexed, this fieldType must not be multivalued. -->
+ <fieldType name="location" class="solr.LatLonType" subFieldSuffix="_coordinate"/>
<!--
A Geohash is a compact representation of a latitude longitude pair in a single field.
@@ -522,7 +522,8 @@
<dynamicField name="*_f" type="float" indexed="true" stored="true"/>
<dynamicField name="*_d" type="double" indexed="true" stored="true"/>
- <dynamicField name="*_latlon" type="double" indexed="true" stored="false"/>
+ <!-- Type used to index the lat and lon components for the "location" FieldType -->
+ <dynamicField name="*_coordinate" type="tdouble" indexed="true" stored="false"/>
<dynamicField name="*_dt" type="date" indexed="true" stored="true"/>
<dynamicField name="*_p" type="location" indexed="true" stored="true"/>
Modified: lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/schema/LatLonType.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/schema/LatLonType.java?rev=1041443&r1=1041442&r2=1041443&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/schema/LatLonType.java (original)
+++ lucene/dev/branches/branch_3x/solr/src/java/org/apache/solr/schema/LatLonType.java Thu Dec 2 16:47:15 2010
@@ -82,6 +82,7 @@ public class LatLonType extends Abstract
return f;
}
+
public Query createSpatialQuery(QParser parser, SpatialOptions options) {
BooleanQuery result = new BooleanQuery();
double[] point = new double[0];
@@ -108,13 +109,13 @@ public class LatLonType extends Abstract
double [] west = DistanceUtils.pointOnBearing(point[LAT], point[LONG], options.distance, DistanceUtils.DEG_270_AS_RADS, tmp, options.radius);
ll[LONG] = west[LONG] * DistanceUtils.RADIANS_TO_DEGREES;
-
SchemaField subSF;
Query range;
//TODO: can we reuse our bearing calculations?
double angDist = DistanceUtils.angularDistance(options.distance,
options.radius);//in radians
+
//for the poles, do something slightly different
//Also, note point[LAT] is in radians, but ur and ll are in degrees
if (point[LAT] + angDist > DistanceUtils.DEG_90_AS_RADS) { //we cross the north pole