Spatial queries require JTS

Performing spatial queries that include polygon shapes requires the JTS Topology Suite JAR.

Performing spatial queries that include polygon shapes requires the Java Topology Suite (JTS) JAR. Dynamic fields for spatial subfields use prefix naming conventions to enable using Cassandra map types to store geospatial data. DSE Search includes the Solr Spatial4j library that adds advanced spatial types like polygons to search indexes.

For

Solr spatial field types 

Solr spatial field types (solr.PointType and solr.LatLonType) rely on dynamic fields to store latitude and longitude data. You must declare one field of type solr.TrieDoubleField in the schema for each spatial field type. The prefix subfield naming policy uses Cassandra map types to store geospatial data.

Advanced spatial queries 

Performing spatial queries that include polygon shapes requires that you install the JTS (Java Topology Suite) library into the DataStax Enterprise Solr library directory. Download version 1.13 of the jts.jar file from http://central.maven.org/maven2/com/vividsolutions/jts/1.13/ and install in the Solr library path:

The default Solr library path location depends on the type of installation:
Installer-Services /usr/share/dse/resources/solr/lib
Package installations /usr/share/dse/solr/lib
Installer-No Services and Tarball installations install_location/resources/solr/lib

Spatial predicates 

DataStax Enterprise 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"