【发布时间】:2013-07-10 21:59:29
【问题描述】:
我正在使用具有最新版本的 JTS 和 spatial4j 的 Solr 4.3.0。作为我的schema.xml 中的字段类型,我使用“location_rpt”,就像文档中的描述一样。
Documentation
<field name="standort" type="location_rpt" indexed="true" stored="true" />
现在当我的应用程序像这样创建一个 FilterQuery
standort:"IsWithin (POLYGON((16.243972778320312 48.27016879304729, 16.411170959472656 48.268340583150504, 16.44275665283203 48.19058119922813, 16.32396697998047 48.15921534239267,16.243972778320312 48.27016879304729)))
一切正常。我的问题是当我尝试使用更复杂的多边形(自相交)时 Solr 只显示如下错误:
org.apache.solr.common.SolrException: com.spatial4j.core.exception.InvalidShapeException: Self-intersection at or near point (16.315572194579204, 48.26688289499306, NaN)
相应的查询如下所示:
standort:"IsWithin (POLYGON((16.253585815429688 48.27748097861045, 16.506271362304688 48.23427822033628, 16.418380737304688 48.18646123261718, 16.286544799804688 48.28958948415696,16.253585815429688 48.27748097861045)))"
是否有任何变通方法可以让自相交 polgyon 查询正常工作?
【问题讨论】:
-
顺便说一下,你不应该使用“IsWithin”如果你所有的索引数据都是点——使用“Intersects”。 IsWithin 可以工作,但速度要慢得多,因为它处理索引的非点形状。将来,您需要在字段类型中声明您的索引数据是否严格为点数或更多,以便 Solr 可以在内部做正确的事情。
标签: search solr polygon spatial intersection