You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-commits@lucene.apache.org by Apache Wiki <wi...@apache.org> on 2010/02/19 16:55:57 UTC

[Solr Wiki] Update of "SpatialSearch" by GrantIngersoll

Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Solr Wiki" for change notification.

The "SpatialSearch" page has been changed by GrantIngersoll.
http://wiki.apache.org/solr/SpatialSearch?action=diff&rev1=10&rev2=11

--------------------------------------------------

- <!> [[Solr1.5]] - This page discusses, in many places, uncommitted code.
+ <!> [[Solr1.5]] - This page discusses, in many places, uncommitted code.  See https://issues.apache.org/jira/browse/SOLR-773 for tracking of all related issues.
  
  <<TableOfContents(3)>>
  
@@ -37, +37 @@

  {{{
  http://localhost:8983/solr/select/?q=_val_:"recip(dist(2, store, point(34.0232,-81.0664)),1,1,0)"&fl=*,score
  }}}
- The above computes the [[http://wiki.apache.org/solr/FunctionQuery#dist|the Euclidean distance]] from the lat/lon pair (34.0232,-81.0664) to the store's lat/lon, asking SOLR to [[http://wiki.apache.org/solr/FunctionQuery#recip|invert the distance]] (take 1 / the distance) in order to make longer distances come later in the result list, and finally asking SOLR to return all fields, including the relevancy score.
+ The above computes the [[http://wiki.apache.org/solr/FunctionQuery#dist|the Euclidean distance]] from the point (34.0232,-81.0664) to the store's point, asking SOLR to [[http://wiki.apache.org/solr/FunctionQuery#recip|invert the distance]] (take 1 / the distance) in order to make longer distances come later in the result list, and finally asking SOLR to return all fields, including the relevancy score.
  
  = Data Representation =
- One of the keys to data representation is the ability to represent points, etc. in multiple different ways.  Some times, a user may want a [[http://en.wikipedia.org/wiki/Geohash|Geohash]] and other times they may want Cartesian tiers or just simple lat/lon.
+ One of the keys to data representation is the ability to represent points, etc. in multiple different ways.  Some times, a user may want a [[http://en.wikipedia.org/wiki/Geohash|Geohash]] and other times they may want Spatial Tiles (!SpatialTileField) (also called map grids, cartesian tiers and other things), a Latitude/Longitude (LatLonType) point or just simple point (!PointType) in an n-dimensional rectangular coordinate system.
  
  == Points ==
  === Numerics ===
- The Trie* fields are perfect for representing lat/lon in two distinct fields.  Additionally, as of https://issues.apache.org/jira/browse/SOLR-1131, there is now a !PointType that supports transparently representing a point in n-dimensional space
+ The Trie* fields are perfect for representing lat/lon in two distinct fields.  Additionally, as of https://issues.apache.org/jira/browse/SOLR-1131, there is now a !PointType that supports transparently representing a point in n-dimensional space in a rectangular coordinate system.  Thus, the !PointType might not be appropriate if distance along a sphere or ellipse are desired.
+ 
+ === LatLonType ===
+ 
+ The !LatLonType combines a latitude/longitude point with the characteristics of the !SpatialTileField.  All input is interpreted as latitude then longitude.
  
  === Geohash ===
  A geohash is a way of encoding lat/lon into a single field as a String.  As of https://issues.apache.org/jira/browse/SOLR-1586, it will be possible to create a geohash via FieldType, simply by passing in a Point (lat,lon).  Solr will do the work of converting the point to a geohash.
@@ -66, +70 @@

  There are several different ways to filter in spatial search:
  
   1. By Range Query, as in {{{fq=lat:[-23.0 TO -79.5] AND lon:[56.3 TO 60.3]}}} -- Already implemented
-  1. By the Spatial Filter QParser  - See https://issues.apache.org/jira/browse/SOLR-1568 - <!> TODO <!> - fill in details, including the name of the QParser.
+  1. By the Spatial Filter QParser (!SpatialQParser)  - See https://issues.apache.org/jira/browse/SOLR-1568 - as in {!sfilt fl=location}&pt=49.32,-79.0&dist=20
   1. Using the "frange" QParser, as in {{{fq={!frange l=0 u=400}hsin(0.57, -1.3, lat_rad, lon_rad, 3963.205)}}}
+ 
  
  = Sorting =
  https://issues.apache.org/jira/browse/SOLR-1297 added the ability to sort by function, so sorting by distance is now simply a matter of sorting using the appropriate distance function, just like boosting.