lucene-solr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Wiki <wikidi...@apache.org>
Subject [Solr Wiki] Update of "SpatialSearch" by YonikSeeley
Date Wed, 29 Sep 2010 19:08:56 GMT
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 YonikSeeley.
The comment on this change is: add bbox docs.
http://wiki.apache.org/solr/SpatialSearch?action=diff&rev1=33&rev2=34

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

  <field name="store">37.7752,-122.4232</field>   <!-- San Francisco store
-->
  }}}
  
- == geofilt ==
+ == geofilt - The distance filter ==
- Now let's assume that we are at 45.15,-93.85 (which happens to be 3.437 km from the Buffalo
store).  We can use a '''geofilt''' filter to find all products (documents in our index) with
the field store within 5km of our position:
+ Now let's assume that we are at '''45.15,-93.85''' (which happens to be 3.437 km from the
Buffalo store).  We can use a '''geofilt''' filter to find all products (documents in our
index) with the field '''store''' within '''5km''' of our position:
  
  [[http://localhost:8983/solr/select?wt=json&indent=true&fl=name,store&q=*:*&fq={!geofilt%20pt=45.15,-93.85%20sfield=store%20d=5|...&q=*:*&fq={!geofilt
pt=45.15,-93.85 sfield=store d=5}]]
  
@@ -42, +42 @@

  ...
  }}}
  
- == 
+ == Spatial Query Parameters ==
  The main spatial search related queries, '''geofilt''', '''bbox''', and '''geodist''' default
to looking for normal request parameters, so any of '''pt''', '''sfield''', and '''dist'''
may be factored out and only specified once in a request (even if multiple spatial queries
are used).
  
  Examples:
   *  [[http://localhost:8983/solr/select?wt=json&indent=true&fl=name,store&q=*:*&fq={!geofilt%20sfield=store}&pt=45.15,-93.85&d=5|...&q=*:*&fq={!geofilt
sfield=store}&pt=45.15,-93.85&d=5]]
   *  [[http://localhost:8983/solr/select?wt=json&indent=true&fl=name,store&q=*:*&fq={!geofilt}&sfield=store&pt=45.15,-93.85&d=5|...&q=*:*&fq={!geofilt}&sfield=store&pt=45.15,-93.85&d=5]]
+ 
+ == bbox - Bounding-box filter ==
+ Exact distance calculations can be somewhat expensive and it can often make sense to use
a quick approximation instead.
+ The '''bbox''' filter is guaranteed to encompass all of the points of interest, but it may
also include other points that are slightly outside of the required distance.  For our standard
!LatLonType, this is implemented as a bounding box - a box made up of a range of lattitudes
and longitudes that encompasses the circle of radius '''d''' (i.e. it will select the same
or slightly more documents than '''geofilt''' will).
+ 
+ The parameters are exactly the same as '''geofilt''', so the following request will still
match everything in the Buffalo store:
+    [[http://localhost:8983/solr/select?wt=json&indent=true&fl=name,store&q=*:*&fq={!bbox}&sfield=store&pt=45.15,-93.85&d=5|...&q=*:*&fq={!bbox}&sfield=store&pt=45.15,-93.85&d=5]]
+ 
+ Because the bounding box is less selective, if we change our distance to 3km it will still
include the Buffalo store (which is actually 3.437 km away).  If we used the more accurate
'''geofilt''' at 3km, these documents not match.  There are many scenarios when the bounding
box can make sense though - especially if you are sorting by some other criteria anyway, or
sorting by distance itself.
+ 
  
  
  

Mime
View raw message