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 kjdong <zh...@foxmail.com> on 2017/06/02 09:04:16 UTC
why MULTILINESTRING can contains polygon in solr spatial search
solr-version:4.7.0
field spec as follows:
<fieldType name="location_rpt"
class="solr.SpatialRecursivePrefixTreeFieldType"
spatialContextFactory="com.spatial4j.core.context.jts.JtsSpatialContextFactory"
validationRule="repairBuffer0" geo="true" distErrPct="0.025"
maxDistErr="0.000009" units="degrees" />
<field name="geom" type="location_rpt" indexed="true" stored="true"
multiValued="true"/>
And i index some MULTILINESTRING (wkt formatted shape, the road data), and
i query use "Intersects" spatial predicates like
fq=geom:"Intersects(POLYGON((-10 30, -40 40, -10 -20, 40 20, 0 0, -10 30)))
distErrPct=0".
In fact, i want to query the shape(multiline) which is intersect with the
query polygon, but the searched return document has nothing to do with the
query polygon(aka, isDisjointTo), then i test it use JTS api ,it indeed
return false, but solr think the line intersects with the polygon ,even
contains. is this a bug? or repair it in advanced version?
Geometry line = new WKTReader.read(the line wkt text string);
Geometry polygon= new WKTReader.read(the polygon wkt text string);
line.intersects(polygon);//return false
--
View this message in context: http://lucene.472066.n3.nabble.com/why-MULTILINESTRING-can-contains-polygon-in-solr-spatial-search-tp4338593.html
Sent from the Solr - User mailing list archive at Nabble.com.
Re: why MULTILINESTRING can contains polygon in solr spatial search
Posted by David Smiley <da...@gmail.com>.
Hi,
Solr 4.7 is old but is probably okay. Is it easy to try a 6.x version?
(note Spatial4j java package names have changed). There's also multiple
new pertinent options to your scenario:
https://locationtech.github.io/spatial4j/apidocs/org/locationtech/spatial4j/context/jts/JtsSpatialContextFactory.html
* "useJtsMulti":"false" (defaults to true)
* "useJtsLineString":"false" (defaults to true)
Any way, this could be due to the validationRule="repairBuffer0" logic if
per chance the indexed shape isn't considered "valid" (by JTS).
If flipping these options and using a recent Solr/Lucene/Spatial4j release
don't fix the issue, please file a JIRA issue to the Lucene project.
On Fri, Jun 2, 2017 at 5:53 AM kjdong <zh...@foxmail.com> wrote:
> solr-version:4.7.0
>
> field spec as follows:
> <fieldType name="location_rpt"
> class="solr.SpatialRecursivePrefixTreeFieldType"
>
> spatialContextFactory="com.spatial4j.core.context.jts.JtsSpatialContextFactory"
> validationRule="repairBuffer0" geo="true" distErrPct="0.025"
> maxDistErr="0.000009" units="degrees" />
>
> <field name="geom" type="location_rpt" indexed="true" stored="true"
> multiValued="true"/>
>
> And i index some MULTILINESTRING (wkt formatted shape, the road data), and
> i query use "Intersects" spatial predicates like
> fq=geom:"Intersects(POLYGON((-10 30, -40 40, -10 -20, 40 20, 0 0, -10 30)))
> distErrPct=0".
>
> In fact, i want to query the shape(multiline) which is intersect with the
> query polygon, but the searched return document has nothing to do with the
> query polygon(aka, isDisjointTo), then i test it use JTS api ,it indeed
> return false, but solr think the line intersects with the polygon ,even
> contains. is this a bug? or repair it in advanced version?
>
> Geometry line = new WKTReader.read(the line wkt text string);
> Geometry polygon= new WKTReader.read(the polygon wkt text string);
> line.intersects(polygon);//return false
>
>
>
>
>
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/why-MULTILINESTRING-can-contains-polygon-in-solr-spatial-search-tp4338593.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