Spatial queries with polygons require JTS

JTS is required to index polygon/multipolygon andor perform queries that include polygon shapes.

JTS (Java Topology Suite) is required to index polygon and multi-polygon shapes and perform queries using polygon shapes. Dynamic fields for spatial subfields use prefix naming conventions to enable map types to store geospatial data. DSE Search includes the Apache Solr Spatial4j library that adds advanced spatial types like polygons to search indexes.

Spatial field type with JTS enabled

For optimal indexing of multipolygon shapes, you must set useJtsMulti="false". For example:
<fieldType autoIndex="true" useJtsMulti="false" 
          class="solr.SpatialRecursivePrefixTreeFieldType" distErrPct="0.0125" 
          distanceUnits="kilometers" geo="true" name="WktField" spatialContextFactory="org.locationtech.
          spatial4j.context.jts.JtsSpatialContextFactory"/>

Advanced spatial queries using spatial predicates

DSE Search supports these spatial predicates:
  • Intersects
  • IsWithin
  • IsDisjointTo
  • Contains

Examples

Intersects
fq=geo:"Intersects(-74.093 41.042 -69.347 44.558)"
IsWithin
fq=geo:"IsWithin(POLYGON((-10 30, -40 40, -10 -20, 40 20, 0 0, -10 30))) distErrPct=0"
IsDisjointTo
fq=geo:"IsDisjointTo(POLYGON((-10 30, -40 40, -10 -20, 40 20, 0 0, -10 30))) distErrPct=0"
Contains
fq=geo:"Contains(POLYGON((-10 30, -40 40, -10 -20, 40 20, 0 0, -10 30))) distErrPct=0"