[ 
https://issues.apache.org/jira/browse/SOLR-1568?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12915628#action_12915628
 ] 

Yonik Seeley edited comment on SOLR-1568 at 9/28/10 2:01 AM:
-------------------------------------------------------------

Here's a patch that implements a more user friendly distance function called 
"sdist".
Way back, the original plan was to dispatch function queries as well as filters 
through the SpatialQueryable interface - but for now this is hardcoded to 
haversine on vector value sources.

Like sfilt, if needed, it can read arguments from the global params "pt" and 
"sfield".  This will make it easy for a user to set these once in a request and 
still use a number of filter and distance operations w/o repeating those params.

Examples:
  sfilt(1,2,3,4)
  sfilt($a,$b)&a=1,2&b=3,4
  sfilt(1,2)&pt=3,4
  sfilt(1,2)&sfield=store
  sfilt()&pt=1,2&sfield=store
  sfilt(store1,store2)
  sfilt(vector(mylat,mylon),3,4)
  sfilt(mylat,mylon,3,4)

If it detects that one of the points is constant, and the other is a vector 
value source (the standard case)
 it uses a slightly more optimized version of haversine that avoids one cosine 
call and also avoids getting multiple values through an array.

edit: oh, and everything is in *degrees* (users really don't want radians), 
distances are on earth (i.e. the sphere radius is not specified), and 
calculated distance values are in km.

      was (Author: [email protected]):
    Here's a patch that implements a more user friendly distance function 
called "sdist".
Way back, the original plan was to dispatch function queries as well as filters 
through the SpatialQueryable interface - but for now this is hardcoded to 
haversine on vector value sources.

Like sfilt, if needed, it can read arguments from the global params "pt" and 
"sfield".  This will make it easy for a user to set these once in a request and 
still use a number of filter and distance operations w/o repeating those params.

Examples:
  sfilt(1,2,3,4)
  sfilt($a,$b)&a=1,2&b=3,4
  sfilt(1,2)&pt=3,4
  sfilt(1,2)&sfield=store
  sfilt()&pt=1,2&sfield=store
  sfilt(store1,store2)
  sfilt(vector(mylat,mylon),3,4)
  sfilt(mylat,mylon,3,4)

If it detects that one of the points is constant, and the other is a vector 
value source (the standard case)
 it uses a slightly more optimized version of haversine that avoids one cosine 
call and also avoids getting multiple values through an array.
  
> Implement Spatial Filter
> ------------------------
>
>                 Key: SOLR-1568
>                 URL: https://issues.apache.org/jira/browse/SOLR-1568
>             Project: Solr
>          Issue Type: New Feature
>            Reporter: Grant Ingersoll
>            Assignee: Grant Ingersoll
>            Priority: Minor
>             Fix For: 3.1, 4.0
>
>         Attachments: CartesianTierQParserPlugin.java, 
> SOLR-1568.Mattmann.031010.patch.txt, SOLR-1568.patch, SOLR-1568.patch, 
> SOLR-1568.patch, SOLR-1568.patch, SOLR-1568.patch, SOLR-1568.patch, 
> SOLR-1568.patch, SOLR-1568.patch, SOLR-1568.patch, SOLR-1568.patch, 
> SOLR-1568.patch, SOLR-1568.patch, SOLR-1568.patch, SOLR-1568.patch, 
> SOLR-1568.patch, SOLR-1568.patch, SOLR-1568.patch
>
>
> Given an index with spatial information (either as a geohash, 
> SpatialTileField (see SOLR-1586) or just two lat/lon pairs), we should be 
> able to pass in a filter query that takes in the field name, lat, lon and 
> distance and produces an appropriate Filter (i.e. one that is aware of the 
> underlying field type for use by Solr. 
> The interface _could_ look like:
> {code}
> &fq={!sfilt dist=20}location:49.32,-79.0
> {code}
> or it could be:
> {code}
> &fq={!sfilt lat=49.32 lat=-79.0 f=location dist=20}
> {code}
> or:
> {code}
> &fq={!sfilt p=49.32,-79.0 f=location dist=20}
> {code}
> or:
> {code}
> &fq={!sfilt lat=49.32,-79.0 fl=lat,lon dist=20}
> {code}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to