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 jend <je...@gmail.com> on 2012/11/20 02:24:00 UTC

solr4 MULTIPOLYGON search syntax

Does anybody have any info on how to property construct a multipolygon
search?

Im very interested in

Polygon (search all documents within a shape)
Multipolygon (search all documents within 2+ shapes)
Multipolygon (search all documents with 2+ shapes but not within an area
within a shape - if you can image a donut where you dont search within the
hole in the center)

Im trying to search 2 shapes but get errors at the moment. Polygon searches
work just fine so I have everything installed correctly, but 2 shapes in the
one search as per below is not working. I cant find anything on the net to
try and debug Multipolygons.

My multipolygon query looks like this.
fq=geo:"Intersects(MULTIPOLYGON ((149.4023 -34.6072, 149.4023 -34.8690,
149.9022 -34.8690, 149.9022 -34.6072, 149.4023 -34.6072)), ((151.506958
-33.458943, 150.551147 -33.60547, 151.00708 -34.257216, 151.627808
-33.861293, 151.506958 -33.458943)))"

And I get this error.
ERROR 500

error reading WKT

But a polygon search works fine.
fq=geo:"Intersects(POLYGON((149.4023 -34.6072, 149.4023 -34.8690, 149.9022
-34.8690, 149.9022 -34.6072, 149.4023 -34.6072)))" 




--
View this message in context: http://lucene.472066.n3.nabble.com/solr4-MULTIPOLYGON-search-syntax-tp4021199.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: solr4 MULTIPOLYGON search syntax

Posted by jend <je...@gmail.com>.
Thanks to both of you. 
I got it working as follows after your helpful posts.
I get this polygon search working.
fq=geo:"Intersects(POLYGON((149.4023 -34.6072, 149.4023 -34.8690, 149.9022
-34.8690, 149.9022 -34.6072, 149.4023 -34.6072)))"

AND I can get this search working (as in results returned)
fq=geo:"Intersects(POLYGON((151.506958 -33.458943, 150.551147 -33.60547,
151.00708 -34.257216, 151.627808 -33.861293, 151.506958 -33.458943)))"

But no matter what MULTIPOLYGON I try with various Parentheses combinations
and im still not getting results, I will get results from either only 1 of
the polygons in the multipolygon search, or the error unable to read .

fq=geo:"Intersects(MULTIPOLYGON(((149.4023 -34.6072, 149.4023 -34.8690,
149.9022 -34.8690, 149.9022 -34.6072, 149.4023 -34.6072))), ((151.506958
-33.458943, 150.551147 -33.60547, 151.00708 -34.257216, 151.627808
-33.861293, 151.506958 -33.458943)))"

Returns only the results from the first polygon.

fq=geo:"Intersects(MULTIPOLYGON(((149.4023 -34.6072, 149.4023 -34.8690,
149.9022 -34.8690, 149.9022 -34.6072, 149.4023 -34.6072)), ((151.506958
-33.458943, 150.551147 -33.60547, 151.00708 -34.257216, 151.627808
-33.861293, 151.506958 -33.458943)))"

Gives error 
ERROR 500

error reading WKT

Finally this
fq=geo:"Intersects(MULTIPOLYGON(((149.4023 -34.6072, 149.4023 -34.8690,
149.9022 -34.8690, 149.9022 -34.6072, 149.4023 -34.6072)), ((151.506958
-33.458943, 150.551147 -33.60547, 151.00708 -34.257216, 151.627808
-33.861293, 151.506958 -33.458943))))"

Worked :)



--
View this message in context: http://lucene.472066.n3.nabble.com/solr4-MULTIPOLYGON-search-syntax-tp4021199p4021435.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: solr4 MULTIPOLYGON search syntax

Posted by "Smiley, David W." <ds...@mitre.org>.
Hi jend,

You need an extra layer of parenthesis for MultiPolygon.  I see that you opened up with MULTIPOLYGON((… instead of MULTIPOLYGON(((…   Of course ensure you balance your parenthesis.  For examples of WKT, see Wikipedia:  http://en.wikipedia.org/wiki/Well-known_text

~ David

On Nov 19, 2012, at 8:24 PM, jend wrote:

> Does anybody have any info on how to property construct a multipolygon
> search?
> 
> Im very interested in
> 
> Polygon (search all documents within a shape)
> Multipolygon (search all documents within 2+ shapes)
> Multipolygon (search all documents with 2+ shapes but not within an area
> within a shape - if you can image a donut where you dont search within the
> hole in the center)
> 
> Im trying to search 2 shapes but get errors at the moment. Polygon searches
> work just fine so I have everything installed correctly, but 2 shapes in the
> one search as per below is not working. I cant find anything on the net to
> try and debug Multipolygons.
> 
> My multipolygon query looks like this.
> fq=geo:"Intersects(MULTIPOLYGON ((149.4023 -34.6072, 149.4023 -34.8690,
> 149.9022 -34.8690, 149.9022 -34.6072, 149.4023 -34.6072)), ((151.506958
> -33.458943, 150.551147 -33.60547, 151.00708 -34.257216, 151.627808
> -33.861293, 151.506958 -33.458943)))"
> 
> And I get this error.
> ERROR 500
> 
> error reading WKT
> 
> But a polygon search works fine.
> fq=geo:"Intersects(POLYGON((149.4023 -34.6072, 149.4023 -34.8690, 149.9022
> -34.8690, 149.9022 -34.6072, 149.4023 -34.6072)))" 
> 
> 
> 
> 
> --
> View this message in context: http://lucene.472066.n3.nabble.com/solr4-MULTIPOLYGON-search-syntax-tp4021199.html
> Sent from the Solr - User mailing list archive at Nabble.com.


Re: solr4 MULTIPOLYGON search syntax

Posted by kfdroid <kf...@gmail.com>.
I think you may be missing a set of parenthesis, instead of 
MULTIPOLYGON((point,point,point)),((point,point,point)) you need
MULTIPOLYGON(((point,point,point)),((point,point,point)))



--
View this message in context: http://lucene.472066.n3.nabble.com/solr4-MULTIPOLYGON-search-syntax-tp4021199p4021322.html
Sent from the Solr - User mailing list archive at Nabble.com.