Discussion:
Polygon search query working but NOT Multipolygon
puneeta
2017-06-28 10:44:57 UTC
Permalink
Hi,
I am new to Solr Geospatial data and have set up JTS within solr. I have
geo spatial data with Multipolygons. I am passing the coordinates and trying
to find out which multipolygon contains those coordinates.However, The
search query is working fine if I insert the data as a polygon. The same is
not working if my data is inserted as a Multipolygon. I am unable to figure
out what am I missing. Can anyone suggest where am I going wrong?

Data as Polygon:
{ "parcel_id":"6",
"geo":["POLYGON((-86.452970463 32.449739005,
-86.452889912 32.4494390510001,
-86.453365379 32.449428021000095,
-86.453514854 32.449424535999995))"]
}

Data as Multipolygon:

{ "parcel_id":"6",
"geo":["MULTIPOLYGON(((-86.452970463 32.449739005,
-86.452889912 32.4494390510001,
-86.453365379 32.449428021000095,
-86.453514854 32.449424535999995)))"]
}

My search query:
fq=geo:"Intersects(-86.4530978929999 32.449735102)"

This device surely lies between the polygon (My polygon coordinates are many
more in the actual data. To reduce the size here I have omited few of the
coordinates)

The query is returning only the polygon data. The multipolygon search is not
happening.

Any help is highly appreciated.

Thanks in Advance,
Puneeta



--
View this message in context: http://lucene.472066.n3.nabble.com/Polygon-search-query-working-but-NOT-Multipolygon-tp4343143.html
Sent from the Solr - User mailing list archive at Nabble.com.
David Smiley
2017-06-28 13:09:32 UTC
Permalink
Hi Puneeta,

So what does your field type definition look like? I'd imagine you're using RptWithGeometrySpatialField. And what is your Solr version?

BTW note the settings here https://locationtech.github.io/spatial4j/apidocs/org/locationtech/spatial4j/context/jts/JtsSpatialContextFactory.html <https://locationtech.github.io/spatial4j/apidocs/org/locationtech/spatial4j/context/jts/JtsSpatialContextFactory.html> are reflected as attributes on the field type, thus you can set say useJtsMulti="false" to change the 'multi implementation.

~ David
Post by puneeta
Hi,
I am new to Solr Geospatial data and have set up JTS within solr. I have
geo spatial data with Multipolygons. I am passing the coordinates and trying
to find out which multipolygon contains those coordinates.However, The
search query is working fine if I insert the data as a polygon. The same is
not working if my data is inserted as a Multipolygon. I am unable to figure
out what am I missing. Can anyone suggest where am I going wrong?
{ "parcel_id":"6",
"geo":["POLYGON((-86.452970463 32.449739005,
-86.452889912 32.4494390510001,
-86.453365379 32.449428021000095,
-86.453514854 32.449424535999995))"]
}
{ "parcel_id":"6",
"geo":["MULTIPOLYGON(((-86.452970463 32.449739005,
-86.452889912 32.4494390510001,
-86.453365379 32.449428021000095,
-86.453514854 32.449424535999995)))"]
}
fq=geo:"Intersects(-86.4530978929999 32.449735102)"
This device surely lies between the polygon (My polygon coordinates are many
more in the actual data. To reduce the size here I have omited few of the
coordinates)
The query is returning only the polygon data. The multipolygon search is not
happening.
Any help is highly appreciated.
Thanks in Advance,
Puneeta
--
View this message in context: http://lucene.472066.n3.nabble.com/Polygon-search-query-working-but-NOT-Multipolygon-tp4343143.html
Sent from the Solr - User mailing list archive at Nabble.com.
puneeta
2017-06-28 14:55:07 UTC
Permalink
Hi David,
Thank you for the prompt reply. My field definition in schema.xml is :

I commented the existing location_rpt



And added:
<fieldType name="location_rpt"
class="solr.SpatialRecursivePrefixTreeFieldType"

spatialContextFactory="org.locationtech.spatial4j.context.jts.JtsSpatialContextFactory"
autoIndex="true"
validationRule="repairBuffer0"
distErrPct="0.025"
maxDistErr="0.001"
distanceUnits="kilometers" />

My Solr version is 6.2.1

Thanks,
Puneeta




--
View this message in context: http://lucene.472066.n3.nabble.com/Polygon-search-query-working-but-NOT-Multipolygon-tp4343143p4343162.html
Sent from the Solr - User mailing list archive at Nabble.com.
David Smiley
2017-06-28 15:15:48 UTC
Permalink
I suggest using RptWithGeometry field, and with that change remove distErrPct and maxDistErr. See the ref guide, and note the geometry cache option.
BTW spatialContextFactory can simply be "jts".

If this fixes the issue, then the issue was related to grid approximation.

BTW you never quite said what it was about the results that was wrong. Did you get hits you didn't expect (I'm guessing yes) or the inverse?

~ David
Post by puneeta
Hi David,
I commented the existing location_rpt
<fieldType name="location_rpt"
class="solr.SpatialRecursivePrefixTreeFieldType"
spatialContextFactory="org.locationtech.spatial4j.context.jts.JtsSpatialContextFactory"
autoIndex="true"
validationRule="repairBuffer0"
distErrPct="0.025"
maxDistErr="0.001"
distanceUnits="kilometers" />
My Solr version is 6.2.1
Thanks,
Puneeta
--
View this message in context: http://lucene.472066.n3.nabble.com/Polygon-search-query-working-but-NOT-Multipolygon-tp4343143p4343162.html
Sent from the Solr - User mailing list archive at Nabble.com.
puneeta
2017-06-28 15:32:53 UTC
Permalink
Hi David,
I am sorry ,I did not understand what do you mean by "I suggest using
RptWithGeometry field". Should leave the existing location_rpt definition in
schema.xml?
<fieldType name="location_rpt"
class="solr.SpatialRecursivePrefixTreeFieldType"
geo="true" distErrPct="0.025" maxDistErr="0.001"
distanceUnits="kilometers" />
This line I have commented. Should I uncomment it?

1."remove distErrPct and maxDistErr" -
2.Added usejtsMulti="false"

I will change the field definition as follows, try to execute and report
back.
<fieldType name="location_rpt"
class="solr.SpatialRecursivePrefixTreeFieldType"

<b>jts*="org.locationtech.spatial4j.context.jts.JtsSpatialContextFactory"
autoIndex="true"
validationRule="repairBuffer0"
distanceUnits="kilometers"
*useJtsMulti="false"*/>


The issue I am facing is that the I am not getting the search result for
Multipolygon i.e I should get hits.Currently, the numFound = 0, It should
find atleast 1 record as it does for a Polygon search.

Thanks,
Puneeta
Post by David Smiley
I suggest using RptWithGeometry field, and with that change remove
distErrPct and maxDistErr. See the ref guide, and note the geometry cache
option.
BTW spatialContextFactory can simply be "jts".
If this fixes the issue, then the issue was related to grid approximation.
BTW you never quite said what it was about the results that was wrong.
Did you get hits you didn't expect (I'm guessing yes) or the inverse?
~ David
On Jun 28, 2017, at 10:55 AM, puneeta &lt;
Hi David,
I commented the existing location_rpt
<fieldType name="location_rpt"
class="solr.SpatialRecursivePrefixTreeFieldType"
spatialContextFactory="org.locationtech.spatial4j.context.jts.JtsSpatialContextFactory"
autoIndex="true"
validationRule="repairBuffer0"
distErrPct="0.025"
maxDistErr="0.001"
distanceUnits="kilometers" />
My Solr version is 6.2.1
Thanks,
Puneeta
--
http://lucene.472066.n3.nabble.com/Polygon-search-query-working-but-NOT-Multipolygon-tp4343143p4343162.html
Sent from the Solr - User mailing list archive at Nabble.com.
--
View this message in context: http://lucene.472066.n3.nabble.com/Polygon-search-query-working-but-NOT-Multipolygon-tp4343143p4343184.html
Sent from the Solr - User mailing list archive at Nabble.com.
David Smiley
2017-06-28 15:39:12 UTC
Permalink
https://lucene.apache.org/solr/guide/6_6/spatial-search.html#SpatialSearch-RptWithGeometrySpatialField <https://lucene.apache.org/solr/guide/6_6/spatial-search.html#SpatialSearch-RptWithGeometrySpatialField>
Post by puneeta
Hi David,
I am sorry ,I did not understand what do you mean by "I suggest using
RptWithGeometry field". Should leave the existing location_rpt definition in
schema.xml?
<fieldType name="location_rpt"
class="solr.SpatialRecursivePrefixTreeFieldType"
geo="true" distErrPct="0.025" maxDistErr="0.001"
distanceUnits="kilometers" />
This line I have commented. Should I uncomment it?
1."remove distErrPct and maxDistErr" -
2.Added usejtsMulti="false"
I will change the field definition as follows, try to execute and report
back.
<fieldType name="location_rpt"
class="solr.SpatialRecursivePrefixTreeFieldType"
<b>jts*="org.locationtech.spatial4j.context.jts.JtsSpatialContextFactory"
autoIndex="true"
validationRule="repairBuffer0"
distanceUnits="kilometers"
*useJtsMulti="false"*/>
The issue I am facing is that the I am not getting the search result for
Multipolygon i.e I should get hits.Currently, the numFound = 0, It should
find atleast 1 record as it does for a Polygon search.
Thanks,
Puneeta
Post by David Smiley
I suggest using RptWithGeometry field, and with that change remove
distErrPct and maxDistErr. See the ref guide, and note the geometry cache
option.
BTW spatialContextFactory can simply be "jts".
If this fixes the issue, then the issue was related to grid approximation.
BTW you never quite said what it was about the results that was wrong.
Did you get hits you didn't expect (I'm guessing yes) or the inverse?
~ David
On Jun 28, 2017, at 10:55 AM, puneeta &lt;
Hi David,
I commented the existing location_rpt
<fieldType name="location_rpt"
class="solr.SpatialRecursivePrefixTreeFieldType"
spatialContextFactory="org.locationtech.spatial4j.context.jts.JtsSpatialContextFactory"
autoIndex="true"
validationRule="repairBuffer0"
distErrPct="0.025"
maxDistErr="0.001"
distanceUnits="kilometers" />
My Solr version is 6.2.1
Thanks,
Puneeta
--
http://lucene.472066.n3.nabble.com/Polygon-search-query-working-but-NOT-Multipolygon-tp4343143p4343162.html
Sent from the Solr - User mailing list archive at Nabble.com.
--
View this message in context: http://lucene.472066.n3.nabble.com/Polygon-search-query-working-but-NOT-Multipolygon-tp4343143p4343184.html <http://lucene.472066.n3.nabble.com/Polygon-search-query-working-but-NOT-Multipolygon-tp4343143p4343184.html>
Sent from the Solr - User mailing list archive at Nabble.com <http://nabble.com/>.
puneeta
2017-06-28 16:33:25 UTC
Permalink
Hi David,
I did the following changes:

Changed in schema.xml:
<fieldType name="location_rpt" class="solr.RptWithGeometrySpatialField"

spatialContextFactory="org.locationtech.spatial4j.context.jts.JtsSpatialContextFactory"
autoIndex="true"
validationRule="repairBuffer0"
distanceUnits="kilometers"
useJtsMulti="false"
/>


Added in solrconfig.xml:
<cache name="perSegSpatialFieldCache_geom"
class="solr.LRUCache"
size="256"
initialSize="0"
autowarmCount="100%"
regenerator="solr.NoOpRegenerator"/>

My fields in the core as defined in the schema is:
<Loading Image...>

However, I still face the same issue. No results found for a multipolygon
search.

Not sure whats happening :(

Puneeta
Post by David Smiley
https://lucene.apache.org/solr/guide/6_6/spatial-search.html#SpatialSearch-RptWithGeometrySpatialField
On Jun 28, 2017, at 11:32 AM, puneeta &lt;
Hi David,
I am sorry ,I did not understand what do you mean by "I suggest using
RptWithGeometry field". Should leave the existing location_rpt definition in
schema.xml?
<fieldType name="location_rpt"
class="solr.SpatialRecursivePrefixTreeFieldType"
geo="true" distErrPct="0.025" maxDistErr="0.001"
distanceUnits="kilometers" />
This line I have commented. Should I uncomment it?
1."remove distErrPct and maxDistErr" -
2.Added usejtsMulti="false"
I will change the field definition as follows, try to execute and report
back.
<fieldType name="location_rpt"
class="solr.SpatialRecursivePrefixTreeFieldType"
*
Post by David Smiley
jts*="org.locationtech.spatial4j.context.jts.JtsSpatialContextFactory"
autoIndex="true"
validationRule="repairBuffer0"
distanceUnits="kilometers"
*useJtsMulti="false"*/>
The issue I am facing is that the I am not getting the search result for
Multipolygon i.e I should get hits.Currently, the numFound = 0, It should
find atleast 1 record as it does for a Polygon search.
Thanks,
Puneeta
Post by David Smiley
I suggest using RptWithGeometry field, and with that change remove
distErrPct and maxDistErr. See the ref guide, and note the geometry cache
option.
BTW spatialContextFactory can simply be "jts".
If this fixes the issue, then the issue was related to grid
approximation.
BTW you never quite said what it was about the results that was wrong.
Did you get hits you didn't expect (I'm guessing yes) or the inverse?
~ David
On Jun 28, 2017, at 10:55 AM, puneeta &lt;
Hi David,
I commented the existing location_rpt
<fieldType name="location_rpt"
Post by David Smiley
class="solr.SpatialRecursivePrefixTreeFieldType"
spatialContextFactory="org.locationtech.spatial4j.context.jts.JtsSpatialContextFactory"
autoIndex="true"
validationRule="repairBuffer0"
distErrPct="0.025"
maxDistErr="0.001"
distanceUnits="kilometers" />
My Solr version is 6.2.1
Thanks,
Puneeta
--
http://lucene.472066.n3.nabble.com/Polygon-search-query-working-but-NOT-Multipolygon-tp4343143p4343162.html
Sent from the Solr - User mailing list archive at Nabble.com.
--
http://lucene.472066.n3.nabble.com/Polygon-search-query-working-but-NOT-Multipolygon-tp4343143p4343184.html
Sent from the Solr - User mailing list archive at Nabble.com
--
View this message in context: http://lucene.472066.n3.nabble.com/Polygon-search-query-working-but-NOT-Multipolygon-tp4343143p4343221.html
Sent from the Solr - User mailing list archive at Nabble.com.
David Smiley
2017-06-28 18:14:20 UTC
Permalink
I tried your data in the "JTS TestBuilder" GUI. Firstly, your polygon isn't "closed", but that was easily fixed by repeating the first point at the end. See the attached screenshot of the GUI for what these shapes look like. The red dot (the query point) is outside of this triangular-ish shape, and thus not a match.
Post by puneeta
Hi David,
<fieldType name="location_rpt" class="solr.RptWithGeometrySpatialField"
spatialContextFactory="org.locationtech.spatial4j.context.jts.JtsSpatialContextFactory"
autoIndex="true"
validationRule="repairBuffer0"
distanceUnits="kilometers"
useJtsMulti="false"
/>
<cache name="perSegSpatialFieldCache_geom"
class="solr.LRUCache"
size="256"
initialSize="0"
autowarmCount="100%"
regenerator="solr.NoOpRegenerator"/>
<http://lucene.472066.n3.nabble.com/file/n4343221/SolrGeoFieldDefinition.png>
However, I still face the same issue. No results found for a multipolygon
search.
Not sure whats happening :(
Puneeta
Post by David Smiley
https://lucene.apache.org/solr/guide/6_6/spatial-search.html#SpatialSearch-RptWithGeometrySpatialField
On Jun 28, 2017, at 11:32 AM, puneeta &lt;
Hi David,
I am sorry ,I did not understand what do you mean by "I suggest using
RptWithGeometry field". Should leave the existing location_rpt definition in
schema.xml?
<fieldType name="location_rpt"
class="solr.SpatialRecursivePrefixTreeFieldType"
geo="true" distErrPct="0.025" maxDistErr="0.001"
distanceUnits="kilometers" />
This line I have commented. Should I uncomment it?
1."remove distErrPct and maxDistErr" -
2.Added usejtsMulti="false"
I will change the field definition as follows, try to execute and report
back.
<fieldType name="location_rpt"
class="solr.SpatialRecursivePrefixTreeFieldType"
*
Post by David Smiley
jts*="org.locationtech.spatial4j.context.jts.JtsSpatialContextFactory"
autoIndex="true"
validationRule="repairBuffer0"
distanceUnits="kilometers"
*useJtsMulti="false"*/>
The issue I am facing is that the I am not getting the search result for
Multipolygon i.e I should get hits.Currently, the numFound = 0, It should
find atleast 1 record as it does for a Polygon search.
Thanks,
Puneeta
Post by David Smiley
I suggest using RptWithGeometry field, and with that change remove
distErrPct and maxDistErr. See the ref guide, and note the geometry cache
option.
BTW spatialContextFactory can simply be "jts".
If this fixes the issue, then the issue was related to grid
approximation.
BTW you never quite said what it was about the results that was wrong.
Did you get hits you didn't expect (I'm guessing yes) or the inverse?
~ David
On Jun 28, 2017, at 10:55 AM, puneeta &lt;
Hi David,
I commented the existing location_rpt
<fieldType name="location_rpt"
Post by David Smiley
class="solr.SpatialRecursivePrefixTreeFieldType"
spatialContextFactory="org.locationtech.spatial4j.context.jts.JtsSpatialContextFactory"
autoIndex="true"
validationRule="repairBuffer0"
distErrPct="0.025"
maxDistErr="0.001"
distanceUnits="kilometers" />
My Solr version is 6.2.1
Thanks,
Puneeta
--
http://lucene.472066.n3.nabble.com/Polygon-search-query-working-but-NOT-Multipolygon-tp4343143p4343162.html
Sent from the Solr - User mailing list archive at Nabble.com.
--
http://lucene.472066.n3.nabble.com/Polygon-search-query-working-but-NOT-Multipolygon-tp4343143p4343184.html
Sent from the Solr - User mailing list archive at Nabble.com
--
View this message in context: http://lucene.472066.n3.nabble.com/Polygon-search-query-working-but-NOT-Multipolygon-tp4343143p4343221.html
Sent from the Solr - User mailing list archive at Nabble.com.
puneeta
2017-06-29 02:17:11 UTC
Permalink
Hi David,
Actually my polygon had too many coordinates, so i just omitted some while
posting my query. Here is my complete multipolygon where the last point is
same as the first one:

<add><doc>
<field name="geo">MULTIPOLYGON (((-86.477551331 32.4906056500001,
-86.4776373509999 32.4903921820001, -86.478257247 32.4905655910001,
-86.478250466 32.4905802390001, -86.478243988 32.490593680000096,
-86.47823751 32.490607122, -86.478231749 32.490619100000096, -86.478224637
32.4906340650001, -86.478218237 32.4906475400001, -86.4782118479999
32.490661035000095, -86.4782054789999 32.4906745260001, -86.47820210799989
32.49068166600009, -86.478199132 32.4906880240001, -86.4781928259999
32.490701523, -86.478186533 32.490715047, -86.478183209 32.4907222090001,
-86.47818027999989 32.4907285690001, -86.478174063 32.4907421250001,
-86.478167851 32.4907556540001, -86.478162558 32.490767236000096,
-86.47815905399989 32.490774513000105, -86.477551331 32.4906056500001)))
</field>
</doc></add>

Thanks,
Puneeta
Post by David Smiley
I tried your data in the "JTS TestBuilder" GUI. Firstly, your polygon
isn't "closed", but that was easily fixed by repeating the first point at
the end. See the attached screenshot of the GUI for what these shapes
look like. The red dot (the query point) is outside of this
triangular-ish shape, and thus not a match.
On Jun 28, 2017, at 12:33 PM, puneeta &lt;
Hi David,
<fieldType name="location_rpt" class="solr.RptWithGeometrySpatialField"
spatialContextFactory="org.locationtech.spatial4j.context.jts.JtsSpatialContextFactory"
autoIndex="true"
validationRule="repairBuffer0"
distanceUnits="kilometers"
useJtsMulti="false"
/>
<cache name="perSegSpatialFieldCache_geom"
class="solr.LRUCache"
size="256"
initialSize="0"
autowarmCount="100%"
regenerator="solr.NoOpRegenerator"/>
However, I still face the same issue. No results found for a multipolygon
search.
Not sure whats happening :(
Puneeta
Post by David Smiley
https://lucene.apache.org/solr/guide/6_6/spatial-search.html#SpatialSearch-RptWithGeometrySpatialField
On Jun 28, 2017, at 11:32 AM, puneeta &lt;
Hi David,
I am sorry ,I did not understand what do you mean by "I suggest using
RptWithGeometry field". Should leave the existing location_rpt
definition
in
schema.xml?
<fieldType name="location_rpt"
Post by David Smiley
class="solr.SpatialRecursivePrefixTreeFieldType"
geo="true" distErrPct="0.025" maxDistErr="0.001"
distanceUnits="kilometers" />
This line I have commented. Should I uncomment it?
1."remove distErrPct and maxDistErr" -
2.Added usejtsMulti="false"
I will change the field definition as follows, try to execute and report
back.
<fieldType name="location_rpt"
Post by David Smiley
class="solr.SpatialRecursivePrefixTreeFieldType"
*
Post by David Smiley
jts*="org.locationtech.spatial4j.context.jts.JtsSpatialContextFactory"
autoIndex="true"
validationRule="repairBuffer0"
distanceUnits="kilometers"
*useJtsMulti="false"*/>
The issue I am facing is that the I am not getting the search result for
Multipolygon i.e I should get hits.Currently, the numFound = 0, It should
find atleast 1 record as it does for a Polygon search.
Thanks,
Puneeta
Post by David Smiley
I suggest using RptWithGeometry field, and with that change remove
distErrPct and maxDistErr. See the ref guide, and note the geometry cache
option.
BTW spatialContextFactory can simply be "jts".
If this fixes the issue, then the issue was related to grid approximation.
BTW you never quite said what it was about the results that was wrong.
Did you get hits you didn't expect (I'm guessing yes) or the inverse?
~ David
On Jun 28, 2017, at 10:55 AM, puneeta &lt;
Hi David,
I commented the existing location_rpt
<fieldType name="location_rpt"
Post by David Smiley
Post by David Smiley
class="solr.SpatialRecursivePrefixTreeFieldType"
spatialContextFactory="org.locationtech.spatial4j.context.jts.JtsSpatialContextFactory"
autoIndex="true"
validationRule="repairBuffer0"
distErrPct="0.025"
maxDistErr="0.001"
distanceUnits="kilometers" />
My Solr version is 6.2.1
Thanks,
Puneeta
--
http://lucene.472066.n3.nabble.com/Polygon-search-query-working-but-NOT-Multipolygon-tp4343143p4343162.html
Sent from the Solr - User mailing list archive at Nabble.com.
--
http://lucene.472066.n3.nabble.com/Polygon-search-query-working-but-NOT-Multipolygon-tp4343143p4343184.html
Sent from the Solr - User mailing list archive at Nabble.com
--
http://lucene.472066.n3.nabble.com/Polygon-search-query-working-but-NOT-Multipolygon-tp4343143p4343221.html
Sent from the Solr - User mailing list archive at Nabble.com.
PastedGraphic-1.png (202K)
--
View this message in context: http://lucene.472066.n3.nabble.com/Polygon-search-query-working-but-NOT-Multipolygon-tp4343143p4343342.html
Sent from the Solr - User mailing list archive at Nabble.com.
David Smiley
2017-06-29 04:03:34 UTC
Permalink
This polygon is fairly rectangular with one side having a ton of points.
Nonetheless the query point is clearly far apart from it (it's much lower
(smaller 'y' dimension).
Post by puneeta
Hi David,
Actually my polygon had too many coordinates, so i just omitted some while
posting my query. Here is my complete multipolygon where the last point is
<add><doc>
<field name="geo">MULTIPOLYGON (((-86.477551331 32.4906056500001,
-86.4776373509999 32.4903921820001, -86.478257247 32.4905655910001,
-86.478250466 32.4905802390001, -86.478243988 32.490593680000096,
-86.47823751 32.490607122, -86.478231749 32.490619100000096, -86.478224637
32.4906340650001, -86.478218237 32.4906475400001, -86.4782118479999
32.490661035000095, -86.4782054789999 32.4906745260001, -86.47820210799989
32.49068166600009, -86.478199132 32.4906880240001, -86.4781928259999
32.490701523, -86.478186533 32.490715047, -86.478183209 32.4907222090001,
-86.47818027999989 32.4907285690001, -86.478174063 32.4907421250001,
-86.478167851 32.4907556540001, -86.478162558 32.490767236000096,
-86.47815905399989 32.490774513000105, -86.477551331 32.4906056500001)))
</field>
</doc></add>
Thanks,
Puneeta
Post by David Smiley
I tried your data in the "JTS TestBuilder" GUI. Firstly, your polygon
isn't "closed", but that was easily fixed by repeating the first point at
the end. See the attached screenshot of the GUI for what these shapes
look like. The red dot (the query point) is outside of this
triangular-ish shape, and thus not a match.
On Jun 28, 2017, at 12:33 PM, puneeta &lt;
Hi David,
<fieldType name="location_rpt" class="solr.RptWithGeometrySpatialField"
spatialContextFactory="org.locationtech.spatial4j.context.jts.JtsSpatialContextFactory"
Post by David Smiley
autoIndex="true"
validationRule="repairBuffer0"
distanceUnits="kilometers"
useJtsMulti="false"
/>
<cache name="perSegSpatialFieldCache_geom"
class="solr.LRUCache"
size="256"
initialSize="0"
autowarmCount="100%"
regenerator="solr.NoOpRegenerator"/>
&lt;
http://lucene.472066.n3.nabble.com/file/n4343221/SolrGeoFieldDefinition.png&gt
;
Post by David Smiley
However, I still face the same issue. No results found for a
multipolygon
Post by David Smiley
search.
Not sure whats happening :(
Puneeta
https://lucene.apache.org/solr/guide/6_6/spatial-search.html#SpatialSearch-RptWithGeometrySpatialField
Post by David Smiley
Post by puneeta
&lt;
https://lucene.apache.org/solr/guide/6_6/spatial-search.html#SpatialSearch-RptWithGeometrySpatialField&gt
;
Post by David Smiley
Post by puneeta
On Jun 28, 2017, at 11:32 AM, puneeta &lt;
Hi David,
I am sorry ,I did not understand what do you mean by "I suggest using
RptWithGeometry field". Should leave the existing location_rpt
definition
in
schema.xml?
<fieldType name="location_rpt"
Post by puneeta
class="solr.SpatialRecursivePrefixTreeFieldType"
geo="true" distErrPct="0.025" maxDistErr="0.001"
distanceUnits="kilometers" />
This line I have commented. Should I uncomment it?
1."remove distErrPct and maxDistErr" -
2.Added usejtsMulti="false"
I will change the field definition as follows, try to execute and report
back.
<fieldType name="location_rpt"
Post by puneeta
class="solr.SpatialRecursivePrefixTreeFieldType"
*
Post by puneeta
jts*="org.locationtech.spatial4j.context.jts.JtsSpatialContextFactory"
autoIndex="true"
validationRule="repairBuffer0"
distanceUnits="kilometers"
*useJtsMulti="false"*/>
The issue I am facing is that the I am not getting the search result for
Multipolygon i.e I should get hits.Currently, the numFound = 0, It should
find atleast 1 record as it does for a Polygon search.
Thanks,
Puneeta
Post by David Smiley
I suggest using RptWithGeometry field, and with that change remove
distErrPct and maxDistErr. See the ref guide, and note the geometry cache
option.
BTW spatialContextFactory can simply be "jts".
If this fixes the issue, then the issue was related to grid approximation.
BTW you never quite said what it was about the results that was
wrong.
Post by David Smiley
Post by puneeta
Post by David Smiley
Did you get hits you didn't expect (I'm guessing yes) or the inverse?
~ David
On Jun 28, 2017, at 10:55 AM, puneeta &lt;
Hi David,
I commented the existing location_rpt
<fieldType name="location_rpt"
Post by puneeta
Post by David Smiley
class="solr.SpatialRecursivePrefixTreeFieldType"
spatialContextFactory="org.locationtech.spatial4j.context.jts.JtsSpatialContextFactory"
Post by David Smiley
Post by puneeta
Post by David Smiley
autoIndex="true"
validationRule="repairBuffer0"
distErrPct="0.025"
maxDistErr="0.001"
distanceUnits="kilometers" />
My Solr version is 6.2.1
Thanks,
Puneeta
--
http://lucene.472066.n3.nabble.com/Polygon-search-query-working-but-NOT-Multipolygon-tp4343143p4343162.html
Post by David Smiley
Post by puneeta
Post by David Smiley
Sent from the Solr - User mailing list archive at Nabble.com.
--
http://lucene.472066.n3.nabble.com/Polygon-search-query-working-but-NOT-Multipolygon-tp4343143p4343184.html
Post by David Smiley
Post by puneeta
&lt;
http://lucene.472066.n3.nabble.com/Polygon-search-query-working-but-NOT-Multipolygon-tp4343143p4343184.html&gt
;
Post by David Smiley
Post by puneeta
Sent from the Solr - User mailing list archive at Nabble.com
--
http://lucene.472066.n3.nabble.com/Polygon-search-query-working-but-NOT-Multipolygon-tp4343143p4343221.html
Post by David Smiley
Sent from the Solr - User mailing list archive at Nabble.com.
PastedGraphic-1.png (202K)
&lt;
Loading Image...&gt
;
--
http://lucene.472066.n3.nabble.com/Polygon-search-query-working-but-NOT-Multipolygon-tp4343143p4343342.html
Sent from the Solr - User mailing list archive at Nabble.com.
--
Lucene/Solr Search Committer, Consultant, Developer, Author, Speaker
LinkedIn: http://linkedin.com/in/davidwsmiley | Book:
http://www.solrenterprisesearchserver.com
puneeta
2017-06-29 05:16:38 UTC
Permalink
Hi David, I tried with other point coordinates and it works fine :) I am
still wondering why those coordinates worked with a Polygon though!
Downloading JTS Test builder helped me a lot.

Thank you so much!

Puneeta





--
View this message in context: http://lucene.472066.n3.nabble.com/Polygon-search-query-working-but-NOT-Multipolygon-tp4343143p4343363.html
Sent from the Solr - User mailing list archive at Nabble.com.

Loading...