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/04/05 16:42:45 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=14&rev2=15

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

  === 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 in a rectangular coordinate system.  Thus, the !PointType might not be appropriate if distance along a sphere or ellipse are desired.
  
+ ==== Example ====
+ 
+ {{{<fieldType name="location" class="solr.PointType" dimension="2" subFieldSuffix="_d"/>
+ ...
+ <field name="store" type="location" indexed="true" stored="true"/>
+ }}}
+ 
  === LatLonType ===
  
- The !LatLonType combines a latitude/longitude point with the characteristics of the !SpatialTileField.  All input is interpreted as latitude then longitude.
+ The !LatLonType combines a latitude/longitude point with the characteristics of the !SpatialTileField.  All input is interpreted as latitude then longitude.  The LatLonType can combine both the features of Spatial Tiles (see below) and filtering by distance.
+ 
+ 
+ ==== Example ====
+ 
+ {{{
+ <fieldType name="latLon" class="solr.LatLonType" start="4" end="15" subFieldSuffix="_latLon"/>
+ ...
+ <field name="store_lat_lon" type="latLon" indexed="true" stored="true"/>
+ }}}
  
  === 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.
  
  See http://www.geohash.org and http://en.wikipedia.org/wiki/Geohash
+ 
+ ==== Example ====
+ 
+ {{{
+ <fieldtype name="geohash" class="solr.GeoHashField"/>
+ ...
+ <field name="store_hash" type="geohash" indexed="true" stored="false"/>
+ }}}
  
  === Tiles ===
  (Sometimes called Grids or Tiers or a variety of other things.  See http://www.lucidimagination.com/search/document/e0dc70aa8ade729d/spatial_cartesian_tiers_nomenclature#bcf8a28f8d651022 for discussion)
@@ -61, +85 @@

  A tile is the result of first flattening the world (using a projection) and then dividing up the world into 2^n grid boxes. Each tile (called "n") covers a particular area of the flattened earth, and as n grows bigger, so does the tile resolution. That is, 2nd level tile is at a much coarser resolution than say a tile at level 10 that covers the same area.
  
  See https://issues.apache.org/jira/browse/SOLR-1586 for the !SpatialTileField, which can index points into tiles at multiple levels.
+ 
+ ==== Example ====
+ 
+ {{{
+ <fieldType name="tile" class="solr.SpatialTileField" start="4" end="15" subFieldSuffix="_tiled"/>
+ ...
+ <field name="store_tiles" type="tile" indexed="true" stored="false"/>
+ }}}
  
  = Indexing =
  
@@ -73, +105 @@

   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)}}}
  
+ In practice, for those using Solr's field types above, the Spatial Filter !QParser will automatically make the correct decision about how best to filter.  If an application needs a specific type of filtering for performance or other needs, the best bet is to extend the !FieldType in question with your own needs. 
  
  = 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.
@@ -85, +118 @@

  
  https://issues.apache.org/jira/browse/SOLR-1578 See https://issues.apache.org/jira/browse/SOLR-1568
  
+ = Known Issues =
+ 
+ There are some underlying issues with Lucene's contrib/spatial related to:
+  * Spatial Tiles and large distances: https://issues.apache.org/jira/browse/LUCENE-1921
+  * Issues around the poles: https://issues.apache.org/jira/browse/LUCENE-2367
+ 
  = Useful References =
  
   1. http://www.movable-type.co.uk/scripts/latlong.html