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

Grant Ingersoll commented on SOLR-1568:
---------------------------------------

So, one of the things I'm not sure on here is how best to associate the 
filtering information with the FieldType.  On the one hand, we could have  a 
base class or a small interface that defines the filter call back on the 
FieldType and then the PointType and other spatial FieldTypes could 
implement/extend that capability.  Going this approach means that if someone 
wants to provide a different way of filtering for a FieldType, they would have 
to implement a derived class overriding the method.  For instance, on the 
PointType, the base implementation may be to just generate a range query for 
each field based on distance.  However, if someone wanted a different approach, 
they would then have to extend PointType and register a whole other FieldType, 
let's call it NewFilterPointType.

An alternative approach would be to separate the filter calculation in a 
different class and then somehow associate it with the FieldType (maybe as a 
map).  I've started this to some extent on the last NON WORKING patch, but 
don't feel great about the actual implementation just yet.  In the case above, 
Solr would provide a default implementation (automatically registered) and then 
it could be overridden by configuring in solrconfig.xml.

I'm also open to other suggestions.  I still am pretty open to taking baby 
steps here by defining the API as Yonik described above (more or less, see my 
last patch) but only providing a single implementation right now for the 
Spatial Tile Field Type (Cartesian Tier).

Thoughts and suggestions welcome?  I'd like to get something in Solr pretty 
soon.

> 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: 1.5
>
>         Attachments: CartesianTierQParserPlugin.java, 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.

Reply via email to