Exception indexing polygons with solr (jts not found?)

1.4k views Asked by At

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

There are 1 answers

0
dve On BEST ANSWER

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.