Return-Path: Delivered-To: apmail-lucene-solr-commits-archive@minotaur.apache.org Received: (qmail 60776 invoked from network); 19 Feb 2010 15:56:27 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 19 Feb 2010 15:56:27 -0000 Received: (qmail 9206 invoked by uid 500); 19 Feb 2010 15:56:27 -0000 Delivered-To: apmail-lucene-solr-commits-archive@lucene.apache.org Received: (qmail 9123 invoked by uid 500); 19 Feb 2010 15:56:26 -0000 Mailing-List: contact solr-commits-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: solr-dev@lucene.apache.org Delivered-To: mailing list solr-commits@lucene.apache.org Received: (qmail 9113 invoked by uid 99); 19 Feb 2010 15:56:26 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 19 Feb 2010 15:56:26 +0000 X-ASF-Spam-Status: No, hits=-1998.5 required=10.0 tests=ALL_TRUSTED,WEIRD_PORT X-Spam-Check-By: apache.org Received: from [140.211.11.130] (HELO eos.apache.org) (140.211.11.130) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 19 Feb 2010 15:56:17 +0000 Received: from eos.apache.org (localhost [127.0.0.1]) by eos.apache.org (Postfix) with ESMTP id 1F15817D17 for ; Fri, 19 Feb 2010 15:55:57 +0000 (GMT) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable From: Apache Wiki To: Apache Wiki Date: Fri, 19 Feb 2010 15:55:57 -0000 Message-ID: <20100219155557.1200.24650@eos.apache.org> Subject: =?utf-8?q?=5BSolr_Wiki=5D_Update_of_=22SpatialSearch=22_by_GrantIngersoll?= Dear Wiki user, You have subscribed to a wiki page or wiki category on "Solr Wiki" for chan= ge notification. The "SpatialSearch" page has been changed by GrantIngersoll. http://wiki.apache.org/solr/SpatialSearch?action=3Ddiff&rev1=3D10&rev2=3D11 -------------------------------------------------- - [[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 rel= ated issues. = <> = @@ -37, +37 @@ {{{ http://localhost:8983/solr/select/?q=3D_val_:"recip(dist(2, store, point(= 34.0232,-81.0664)),1,1,0)"&fl=3D*,score }}} - The above computes the [[http://wiki.apache.org/solr/FunctionQuery#dist|t= he Euclidean distance]] from the lat/lon pair (34.0232,-81.0664) to the sto= re's lat/lon, asking SOLR to [[http://wiki.apache.org/solr/FunctionQuery#re= cip|invert the distance]] (take 1 / the distance) in order to make longer d= istances come later in the result list, and finally asking SOLR to return a= ll fields, including the relevancy score. + The above computes the [[http://wiki.apache.org/solr/FunctionQuery#dist|t= he Euclidean distance]] from the point (34.0232,-81.0664) to the store's po= int, asking SOLR to [[http://wiki.apache.org/solr/FunctionQuery#recip|inver= t 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. = =3D Data Representation =3D - 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 Carte= sian 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 Spati= al Tiles (!SpatialTileField) (also called map grids, cartesian tiers and ot= her things), a Latitude/Longitude (LatLonType) point or just simple point (= !PointType) in an n-dimensional rectangular coordinate system. = =3D=3D Points =3D=3D =3D=3D=3D Numerics =3D=3D=3D - The Trie* fields are perfect for representing lat/lon in two distinct fie= lds. 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 fie= lds. 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 !Poin= tType might not be appropriate if distance along a sphere or ellipse are de= sired. + = + =3D=3D=3D LatLonType =3D=3D=3D + = + The !LatLonType combines a latitude/longitude point with the characterist= ics of the !SpatialTileField. All input is interpreted as latitude then lo= ngitude. = =3D=3D=3D Geohash =3D=3D=3D 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=3Dlat:[-23.0 TO -79.5] AND lon:[56.3 TO 6= 0.3]}}} -- Already implemented - 1. By the Spatial Filter QParser - See https://issues.apache.org/jira/b= rowse/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=3Dlocation}&pt=3D49.32= ,-79.0&dist=3D20 1. Using the "frange" QParser, as in {{{fq=3D{!frange l=3D0 u=3D400}hsin= (0.57, -1.3, lat_rad, lon_rad, 3963.205)}}} + = = =3D Sorting =3D 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 usin= g the appropriate distance function, just like boosting.