lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Emir Arnautovic <emir.arnauto...@sematext.com>
Subject Re: Boolean expression for spatial query
Date Mon, 27 Feb 2017 09:12:37 GMT
Hi Michael,

I haven't been playing with spatial for a while, but if it fully 
supports WKT, you could use Intersects instead of Contains and 
MULTIPOINT instead of POINT. Something like:

fq={!field f=regionGeometry}Intersects(MULTIPOINT((x1 y1), (x2, y2)))

In any case you can use OR-ed _query_:

fq=_query_:"{!field f=regionGeometry}Contains(POINT(x1, y1))" OR 
_query_:"{!field f=regionGeometry}Contains(POINT(x2, y2))"


HTH
Emir


On 26.02.2017 07:08, Michael Dürr wrote:
> Hi all,
>
> I index documents containing a spatial field (rpt) that holds a wkt
> multipolygon. In order to retrieve all documents for which a certain point
> is contained within a polygon I issue the following query:
>
> q=*:*&fq={!field f=regionGeometry}Contains(POINT(<x> <y>))
>
> This works pretty good.
>
> My question is: Is there any syntax to issue this query for multiple points
> (i.e. return all documents for which at least one of the points is within
> the document's polygon)?
>
> E.g. something like this:
>
> q=*:*&fq={!field f=regionGeometry}ContainsOR(POINT(<x1> <y1>),POINT(<x2>
> <y2>),...)
>
> If not - what other efficient options do you xuggest to do such a query?
>
> Best regards,
> Michael
>

-- 
Monitoring * Alerting * Anomaly Detection * Centralized Log Management
Solr & Elasticsearch Support * http://sematext.com/


Mime
View raw message