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 DavidSmiley
Date Mon, 19 Mar 2012 06:41:47 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 DavidSmiley:
http://wiki.apache.org/solr/SpatialSearch?action=diff&rev1=82&rev2=83

Comment:
More SOLR-2155 instructions.

  == SOLR-2155 ==
  [[https://issues.apache.org/jira/browse/SOLR-2155|SOLR-2155]] Refers to an issue in JIRA
that uses spatial search techniques based on edge n-gram'ed geohashes with a PrefixTree/Trie
search algorithm. '''If you are using Solr 3x and want a multi-valued geospatial field (both
filter & sort) then this is for you.''' It has been benchmarked showing great performance
too.
  
- As of September 2011, SOLR-2155 was ported to 3x and was made available as a drop-in add-on
to Solr without any patching. Go to the issue and download the "Solr2155-1.0.3-project.zip"
attachment (or newer version if available). Read the README.txt file.  You do need to build
the code, which is as simple as running "mvn install" which generates a jar file: target/Solr2155-1.0.3.jar.
 Put that on Solr's classpath so it's available, similar to how other Solr contrib jars are
installed.
+ As of September 2011, SOLR-2155 was ported to 3x and was made available as a drop-in add-on
to Solr without any patching. Go to the issue and download the "Solr2155-1.0.3-project.zip"
attachment (or newer version if available). Read the README.txt file.  You do need to build
the code, which is as simple as running "mvn install" which generates a jar file: target/Solr2155-1.0.3.jar.
 Put that on Solr's classpath so it's available, similar to how other Solr contrib jars are
installed.  Then you can create a field type in {{{schema.xml}}} like so:
+ {{{<fieldType name="geohash" class="solr2155.solr.schema.GeoHashField" length="12" />}}}
+ Of course you need to refer to this field type in one of your fields as well.  The {{{length}}}
attribute refers to the length of the underlying geohash and thus the precision of the data.
Refer to the [[http://en.wikipedia.org/wiki/Geohash#Worked_example|table at Wikipedia]] to
see what the error distances are for each length.  You can use the {{{geofilt}}} and {{{bbox}}}
query parsers to perform a geospatial filter.  If you wish to sort with {{{geodist}}} to get
sorting by closest distance of multiple values, then you must register a special query parser:
+ {{{<valueSourceParser name="geodist" class="solr2155.solr.search.function.distance.HaversineConstFunction$HaversineValueSourceParser"
/>}}}
+ 
+ SOLR-2155 includes a query parser that allows a specific bounding box query input.  By contrast,
{{{bbox}}} is limited to the bounding box of a point-radius.  If you want to use this optional
query parser, you must register it like so:
+ {{{<queryParser name="gh_geofilt" class="solr2155.solr.search.SpatialGeoHashFilterQParser$Plugin"
/>}}}
+ And then to do a bounding box, specify like so (args are in west,south,east,north order):
+ {{{...fq={!gh_geofilt sfield=store box="-98,35,-97,36"} }}}
  
  == LatLonType ==
  The !LatLonType is the current default spatial field.  Values for this type are of the form
{{{latitude,longitude}}}, although behind the scenes, the latitude and longitude are indexed
as separate numbers. Fields using !LatLonType must be single valued (i.e. multiValued="false").
 This field type does distance calculations based on Great Circle (haversine).

Mime
View raw message