You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by mladen micevic <mm...@yahoo.com> on 2012/12/25 20:28:33 UTC
Spatial filter in solr 4.0 - "Intersects" operation with parameters
Hi,
I went through example for spatial search in Solr 4.0
(http://wiki.apache.org/solr/SolrAdaptersForLuceneSpatial4)
Both indexing and searching work fine.
Example is: fq=geo:"Intersects(-74.093 41.042 -69.347 44.558)"
My problem is how to send values to "Intersects" operation as parameters.
If would like to send custom parameters in URL:
...&lon1=-74.093&lat1=41.042&lon2=-69.347&lat2=44.558
and have default filter query:
fq=geo:"Intersects($lon1 $lat1 $lon2 $lat2)
I tried this approach - but it did not work.
How do I do this?
Using {!bbox} is not documented in 4.0 wiki.
Anyways, I tried to use it against "geo" field but got following error:
field does not support spatial filtering ...
Can I use {!bbox} in 4.0 ?
Thanks.
Mladen
--
View this message in context: http://lucene.472066.n3.nabble.com/Spatial-filter-in-solr-4-0-Intersects-operation-with-parameters-tp4029034.html
Sent from the Solr - User mailing list archive at Nabble.com.
Re: Spatial filter in solr 4.0 - "Intersects" operation with
parameters
Posted by "David Smiley (@MITRE.org)" <DS...@mitre.org>.
It's unusual to have Solr be the first point of entry into a service.
Usually it's fronted with a web application that has the business logic that
knows how to map the request to the search back-end.
Given your further questions, almost anything could work without much
trouble:
* A standard servlet filter
* A search component
* A subclass of SearchHandler
The search component would probably be easy and most appropriate as you
could register it clearly in solr's config file vs. semi-hidden in web.xml
~ David
mladen micevic wrote
> Thank you David for your quick response.
> I was thinking yesterday about my problem.
> Caller should not be aware of internals of my Solr configuration (filed
> name, operation).
> Caller can describe search area with center point and radius and I need to
> translate input parameters into Solr query.
> Now, I need to have some custom solution in between caller and Solr.
> What would be your recommendation how to do it?
> Is there any search component that has access to all input parameters and
> can create Solr query and pass it to normal search flow defined in search
> handler?
> Should I create customized implementation of Request Handler?
> What would be the best way?
> Please advise.
>
> Thanks
> Mladen
-----
Author: http://www.packtpub.com/apache-solr-3-enterprise-search-server/book
--
View this message in context: http://lucene.472066.n3.nabble.com/Spatial-filter-in-solr-4-0-Intersects-operation-with-parameters-tp4029034p4029246.html
Sent from the Solr - User mailing list archive at Nabble.com.
Re: Spatial filter in solr 4.0 - "Intersects" operation with
parameters
Posted by mladen micevic <mm...@yahoo.com>.
Thank you David for your quick response.
I was thinking yesterday about my problem.
Caller should not be aware of internals of my Solr configuration (filed
name, operation).
Caller can describe search area with center point and radius and I need to
translate input parameters into Solr query.
Now, I need to have some custom solution in between caller and Solr.
What would be your recommendation how to do it?
Is there any search component that has access to all input parameters and
can create Solr query and pass it to normal search flow defined in search
handler?
Should I create customized implementation of Request Handler?
What would be the best way?
Please advise.
Thanks
Mladen
--
View this message in context: http://lucene.472066.n3.nabble.com/Spatial-filter-in-solr-4-0-Intersects-operation-with-parameters-tp4029034p4029208.html
Sent from the Solr - User mailing list archive at Nabble.com.
Re: Spatial filter in solr 4.0 - "Intersects" operation with
parameters
Posted by "David Smiley (@MITRE.org)" <DS...@mitre.org>.
Mladen,
FYI I just committed this to 4.x:
https://issues.apache.org/jira/browse/SOLR-4230
~ David
mladen micevic wrote
> Hi,
> I went through example for spatial search in Solr 4.0
> (http://wiki.apache.org/solr/SolrAdaptersForLuceneSpatial4)
> Both indexing and searching work fine.
>
> Example is: fq=geo:"Intersects(-74.093 41.042 -69.347 44.558)"
>
> My problem is how to send values to "Intersects" operation as parameters.
> If would like to send custom parameters in URL:
> ...&lon1=-74.093&lat1=41.042&lon2=-69.347&lat2=44.558
> and have default filter query:
> fq=geo:"Intersects($lon1 $lat1 $lon2 $lat2)
> I tried this approach - but it did not work.
>
> How do I do this?
>
> Using {!bbox} is not documented in 4.0 wiki.
> Anyways, I tried to use it against "geo" field but got following error:
> field does not support spatial filtering ...
> Can I use {!bbox} in 4.0 ?
>
>
> Thanks.
> Mladen
-----
Author: http://www.packtpub.com/apache-solr-3-enterprise-search-server/book
--
View this message in context: http://lucene.472066.n3.nabble.com/Spatial-filter-in-solr-4-0-Intersects-operation-with-parameters-tp4029034p4030138.html
Sent from the Solr - User mailing list archive at Nabble.com.
Re: Spatial filter in solr 4.0 - "Intersects" operation with
parameters
Posted by "David Smiley (@MITRE.org)" <DS...@mitre.org>.
Hi Mladen,
Despite some similarities at first glance, the Solr 4 spatial fields are not
implemented with Solr query parsers, unlike Solr 3 spatial. Everything in
quotes is handled by the field type. What you're looking for is for the
Solr 3 geospatial functions to be adapted to support the Solr 4 spatial
fields. I created an issue, SOLR-4230 to track this. I never got around to
doing this before because it wasn't strictly necessary to use the new
fields, but it is of course a nice-to-have.
~ David
mladen micevic wrote
> Hi,
> I went through example for spatial search in Solr 4.0
> (http://wiki.apache.org/solr/SolrAdaptersForLuceneSpatial4)
> Both indexing and searching work fine.
>
> Example is: fq=geo:"Intersects(-74.093 41.042 -69.347 44.558)"
>
> My problem is how to send values to "Intersects" operation as parameters.
> If would like to send custom parameters in URL:
> ...&lon1=-74.093&lat1=41.042&lon2=-69.347&lat2=44.558
> and have default filter query:
> fq=geo:"Intersects($lon1 $lat1 $lon2 $lat2)
> I tried this approach - but it did not work.
>
> How do I do this?
>
> Using {!bbox} is not documented in 4.0 wiki.
> Anyways, I tried to use it against "geo" field but got following error:
> field does not support spatial filtering ...
> Can I use {!bbox} in 4.0 ?
>
>
> Thanks.
> Mladen
-----
Author: http://www.packtpub.com/apache-solr-3-enterprise-search-server/book
--
View this message in context: http://lucene.472066.n3.nabble.com/Spatial-filter-in-solr-4-0-Intersects-operation-with-parameters-tp4029034p4029071.html
Sent from the Solr - User mailing list archive at Nabble.com.