First of all, assuming this is a standard point-in-polygon situation, use
the Intersects predicate -- with point data it's semantically the same as
IsWithin and Intersects is much faster.  I don't know why you used
isDisjointTo in your 2nd example; maybe you want to find when they don't
touch?  Any way, one problem right away I saw is that the first point in
the polygon is not repeated in the last.  That's what the WKT spec demands.


On Fri, Mar 4, 2016 at 1:37 AM Pradeepchandra Mulpuru <
prade...@infologitech.in> wrote:

> Hi Sir,
>
> I have a question on Apache Solr Spatial search. I have a json type data
> of City, Latitude & Longitude. I indexed those fields with locm_place of
> the type location_rpt. Now I want to give a polygon as a filter query in
> order to get the City names located in that polygon. I don't have any idea
> of doing that.
>
> I tried with this:
>
>
> http://localhost:8983/solr/loopback/select?fl=City&wt=json&q=*:*&fq=locm_place:"IsWithin(POLYGON((16.762467717941604
> 78.94775390625,16.99375545289456 78.11279296875%20,17.31917640744285
> 77.98095703125,17.80099604766698 78.72802734375))) distErrPct=0"
>
> It is showing the result like:
>
> {"responseHeader":{"status":400,"QTime":4,"params":{"fl":"City","q":"*:*","wt":"json","fq":"locm_place:\"IsWithin(POLYGON((16.762467717941604
>  78.94775390625, 16.99375545289456 78.11279296875 , 17.31917640744285 
> 77.98095703125 , 17.80099604766698 78.72802734375))) 
> distErrPct=0\""}},"error":{"msg":"Couldn't parse shape 
> 'POLYGON((16.762467717941604 78.94775390625, 16.99375545289456 78.11279296875 
> , 17.31917640744285 77.98095703125 , 17.80099604766698 78.72802734375))' 
> because: Unknown Shape definition [POLYGON((16.762467717941604 
> 78.94775390625, 16.99375545289456 78.11279296875 , 17.31917640744285 
> 77.98095703125 , 17.80099604...]","code":400}}
>
>
> I tried with this:
>
> http://localhost:8983/solr/loopback/select?fl=City&wt=json&q=*:*&fq=geo:%22IsDisjointTo(POLYGON((16.762467717941604%2078.94775390625,%2016.99375545289456%2078.11279296875,17.31917640744285%2077.98095703125,17.80099604766698%2078.72802734375)))%22
>
> It is showing the result like:
>
>
> {"responseHeader":{"status":400,"QTime":21,"params":{"fl":"City","q":"*:*","wt":"json","fq":"geo:\"IsDisjointTo(POLYGON((16.762467717941604
>  78.94775390625, 16.99375545289456 78.11279296875,17.31917640744285 
> 77.98095703125,17.80099604766698 
> 78.72802734375)))\""}},"error":{"msg":"Couldn't parse shape 
> 'POLYGON((16.762467717941604 78.94775390625, 16.99375545289456 
> 78.11279296875,17.31917640744285 77.98095703125,17.80099604766698 
> 78.72802734375))' because: java.lang.IllegalArgumentException: points must 
> form a closed linestring","code":400}}
>
>
> Kindly tell me what I have to change/configure. I am attaching the json 
> file,schema.xml and a screenshot of Solr admin total result query.
>
>
> Thanks and regards,
>
> M Pradeep Chandra
>
> --
Lucene/Solr Search Committer, Consultant, Developer, Author, Speaker
LinkedIn: http://linkedin.com/in/davidwsmiley | Book:
http://www.solrenterprisesearchserver.com

Reply via email to