What Is Geo-Spatial Search?
Imagine you have a giant map with thousands of pins on it — stores, restaurants, landmarks. Now imagine you want to find everything inside a specific shape on that map: a circle around your house, a rectangle over downtown, or even a weird polygon that follows a river.
That is geo-spatial search. You draw a shape, and Solr finds everything inside it.
What Is JTS Topology Suite?
Regular Solr can only search inside simple shapes — mostly circles and rectangles. But real-world boundaries are rarely that neat. City limits, delivery zones, national parks — they are all irregular polygons with dozens or hundreds of points.
JTS Topology Suite is a geometry library that gives Solr the power to understand and search inside complex polygons. Think of it as upgrading Solr from "find stuff near this point" to "find stuff inside this exact boundary."
Is JTS Enabled on My Opensolr Index?
In most Opensolr servers and data centers, JTS support is enabled by default. Your Opensolr Index is ready for polygonal geo-spatial queries right out of the box.
If you try a polygon query and get an error about JTS not being available, contact our support team and we will enable it for your server immediately.
Do I Need to Set Anything Up?
No. Once JTS is enabled on the server, there is nothing extra to configure. You can start sending polygon queries right away using Solr's spatial field types like SpatialRecursivePrefixTreeFieldType (RPT) or BBoxField.
Example schema field for geo-spatial search:
<fieldType name="location_rpt" class="solr.SpatialRecursivePrefixTreeFieldType" spatialContextFactory="JTS" geo="true" distErrPct="0.025" maxDistErr="0.001" /> <field name="geo" type="location_rpt" indexed="true" stored="true" />
Example polygon query:
q=*:*&fq={!field f=geo}Intersects(POLYGON((-10 30, 20 30, 20 50, -10 50, -10 30)))
This finds all documents whose geo field falls inside the specified polygon.
Quick Reference
| Feature | Without JTS | With JTS (Opensolr) |
|---|---|---|
| Circle queries | Yes | Yes |
| Rectangle queries | Yes | Yes |
| Polygon queries | No | Yes |
| Multi-polygon queries | No | Yes |
| Arbitrary shape queries | No | Yes |
| Setup required | — | None |
Need help setting up geo-spatial search on your Opensolr Index? Reach out to us at support@opensolr.com — we are happy to help you draw the right shapes.