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 Novin <no...@temetra.com> on 2015/06/12 10:34:12 UTC

Solr result with Intersects QUery is unexpected

Hello,

I am doing Intersect query and I am getting unexpected results. Details 
is below:

Below is the solr schema definition I am using for indexing polygons.

<fieldType name="location_rpt" 
class="solr.SpatialRecursivePrefixTreeFieldType"
spatialContextFactory="com.spatial4j.core.context.jts.JtsSpatialContextFactory"
         geo="true" distErrPct="0.010" maxDistErr="0.000005" 
distanceUnits="degrees" />

<field name="geopolygon" type="location_rpt" indexed="true" 
stored="false" required="false" multiValued="true"/>

Format of Polygon is indexed

POLYGON((-0.154839 51.508315,-0.15265 51.506365,-0.151019 
51.503267,-0.161984 51.502732,-0.173357 51.502385,-0.184085 
51.502291,-0.190759 51.501984,-0.192325 51.504095,-0.192926 
51.504161,-0.193591 51.504509,-0.194299 51.505724,-0.194879 
51.508248,-0.195329 51.509223,-0.197046 51.508889,-0.197325 
51.511039,-0.197346 51.513203,-0.195029 51.515072,-0.196273 
51.518878,-0.198441 51.518571,-0.201037 51.521455,-0.201681 
51.524218,-0.194085 51.530827,-0.191917 51.53387,-0.189557 
51.535098,-0.188398 51.534244,-0.175095 51.523511,-0.167842 
51.518304,-0.160246 51.513336,-0.154839 51.508315))

POLYGON((-0.354266 51.429023,-0.34976 51.428059,-0.35182 
51.42426,-0.352077 51.419416,-0.352721 51.410771,-0.360103 
51.412778,-0.370145 51.410771,-0.379157 51.407826,-0.388041 
51.409299,-0.393233 51.409218,-0.400186 51.406354,-0.409455 
51.404346,-0.428295 51.386325,-0.432587 51.387825,-0.432458 
51.38978,-0.43469 51.391574,-0.436277 51.393556,-0.43323 
51.398777,-0.434217 51.402927,-0.43263 51.4044,-0.431514 
51.410021,-0.430355 51.411841,-0.430441 51.413876,-0.442929 
51.415749,-0.448594 51.422868,-0.451598 51.423457,-0.474343 
51.425919,-0.472798 51.426802,-0.481296 51.430441,-0.488591 
51.43127,-0.491509 51.433063,-0.451641 51.438948,-0.406666 
51.448551,-0.396602 51.450236,-0.386002 51.451867,-0.381453 
51.452108,-0.377548 51.452028,-0.358236 51.44946,-0.347743 
51.448003,-0.342507 51.447762,-0.338044 51.448016,-0.338902 
51.443603,-0.339353 51.439082,-0.340383 51.436527,-0.343173 
51.435337,-0.351927 51.43309,-0.354266 51.429023))

Below query I am using for Intersect to get results
geopolygon:"Intersects(ENVELOPE(7.14111, -7.89917, 54.36776, 49.47526))" 
AND id:xyz

Above query does not give any results but below query gives the results. 
I am not sure why. But above query bbox contains and below query's bbox.

geopolygon:"Intersects(ENVELOPE(0.42572, -1.45432, 51.97304, 51.3572))" 
AND id:xyz

Am I missing something  or doing wrong query?

I've also tried Contains too, but does not fit requirement. And problem 
is same as intersect.

Any kind of help would be appreciated. and let  me know if you guys need 
more details.

Thanks for your time,
Novin