问题描述
我正在使用Solr 4.3.0和最新版本的JTS和spatial4j.作为我的schema.xml
中的字段类型,我使用的是"location_rpt",如文档中的描述.文档
I’m using Solr 4.3.0 with an up to date version of JTS and spatial4j. As field type in my schema.xml
i’m using "location_rpt" like the description in the documentation.Documentation
<field name="standort" type="location_rpt" indexed="true" stored="true" />
现在,当我的应用程序创建这样的FilterQuery
Now when my Application create a FilterQuery like this
standort:"IsWithin (POLYGON((16.243972778320312 48.27016879304729, 16.411170959472656 48.268340583150504, 16.44275665283203 48.19058119922813, 16.32396697998047 48.15921534239267,16.243972778320312 48.27016879304729)))
一切正常.我的问题是,当我尝试使用更复杂的多边形(自相交)时,Solr仅显示如下错误:
everything works fine. My problem is when im trying to use a more complex polygon (self-intersecting) Solr only shows an Error like this:
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查询正常工作?
Are there any workarounds to get self-intersecting polgyon querys to work?
推荐答案
不,不是.您可以在客户端上使用JTS清理多边形,以便在Solr获取多边形时才有效.参见 http://tsusiatsoftware.net/jts/jts-faq/jts- faq.html#G
No, not really. You can use JTS on the client to clean up your polygon so that when Solr gets it, it's valid. See http://tsusiatsoftware.net/jts/jts-faq/jts-faq.html#G
这篇关于具有自相交多边形的Solr空间搜索的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!