Exception indexing polygons with solr (jts not found?)

£可爱£侵袭症+ 提交于 2019-12-23 22:07:43

问题


I'm having trouble setting up solr 4.10.2 to work with polygons. I try to adapt the example application to work with an field called geom with the type location_rpt. I added jts-1.13.jar to the file solr-4.10.2/example/webapps/solr.war in the directory WEB-INF/lib and I created a field in schema.xml:

<field name="geom" type="location_rpt" indexed="true" stored="true" />

I start solr with java -jar start.jar.

But when I try to add a document with a geom field I get an exception:

Caused by: java.text.ParseException: Unknown Shape definition [POLYGON ((12.833040666607534 54.00218401664526, 12.83303934146181 54.10218449095831, 12.999714402162988 54.10218524894654, 12...]
at com.spatial4j.core.io.WktShapeParser.parse(WktShapeParser.java:90)
at com.spatial4j.core.context.SpatialContext.readShapeFromWkt(SpatialContext.java:294)

It seems that the jts jar is not recognized. Do I have to configure it somewhere?

Regards

Daniel


回答1:


I found it: the field definition needs the attribute spatialContextFactory="com.spatial4j.core.context.jts.JtsSpatialContextFactory" or the system property SpatialContextFactory must be set to com.spatial4j.core.context.jts.JtsSpatialContextFactory.



来源:https://stackoverflow.com/questions/27041989/exception-indexing-polygons-with-solr-jts-not-found

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!