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 17:07:39 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: updating doc to be more user oriented, and to reflect changes
in trunk.
http://wiki.apache.org/solr/SpatialSearch?action=diff&rev1=32&rev2=33

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

- <!> [[Solr4.0]] - This page discusses, in many places, uncommitted code.  See https://issues.apache.org/jira/browse/SOLR-773
for tracking of all related issues.
- 
+ <!> [[Solr4.0]]
+ = Spatial Search =
  <<TableOfContents(3)>>
  
  = Introduction =
@@ -11, +11 @@

   1. Filter by some spatial concept such as a bounding box or other shape
   1. Sort by distance
   1. Score/boost by distance
-  1. Build a query parser that handles textual and location queries seamlessly
  
- Most of these items are being tracked on https://issues.apache.org/jira/browse/SOLR-773
and it's related issues.  The goal is to bring spatial search into Solr in such a way as to
leverage all of Solr's existing capabilities for distributed search, etc.
+ '''NOTE: Unless otherwise specified, all units of distance are kilometers and points are
in degrees of latitude,longitude.'''
  
- '''NOTE: Unless otherwise specified, all units of distance are kilometers.  We decided to
pick one unit and stick with it, allowing applications to do the conversion if necessary.'''
+ = QuickStart =
+ If you haven't already, get a recent nightly build of [[Solr4.0]], start the example server
and index the example data as shown in the [[http://lucene.apache.org/solr/tutorial.html|solr
tutorial]].
+ 
+ In the example data, certain documents have a field called "store" (with a fieldType named
"location" implemented via !LatLonType).  Some of the points in the example data are:
+ {{{
+ <field name="store">45.17614,-93.87341</field>  <!-- Buffalo store -->
+ <field name="store">40.7143,-74.006</field>     <!-- NYC store -->
+ <field name="store">37.7752,-122.4232</field>   <!-- San Francisco store
-->
+ }}}
+ 
+ == geofilt ==
+ 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}]]
+ 
+ Sure enough, we find 8 products at the Buffalo store:
+ {{{
+ ...
+   "response":{"numFound":8,"start":0,"docs":[
+       {
+         "name":"Samsung SpinPoint P120 SP2514N - hard drive - 250 GB - ATA-133",
+         "store":"45.17614,-93.87341"},
+       {
+         "name":"Maxtor DiamondMax 11 - hard drive - 500 GB - SATA-300",
+         "store":"45.17614,-93.87341"},
+ ...
+ }}}
+ 
+ == 
+ 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]]
+ 
+ 
+ 
+ = EDITING IN PROGRESS - ANYTHING BELOW THIS LINE MAY NOT BE ACCURATE =
+ 
  
  = An Example =
  On https://issues.apache.org/jira/browse/SOLR-1131, the example schema was changed to provide
information about what store the products were located in.

Mime
View raw message