Lucene 4.2.1 spatial API

The Spatial Module for Apache Lucene


org.apache.lucene.spatial Lucene spatial search
org.apache.lucene.spatial.prefix Prefix Tree Strategy
org.apache.lucene.spatial.prefix.tree The Spatial Prefix package supports spatial indexing by index-time tokens where adding characters to a string gives greater resolution.
org.apache.lucene.spatial.query Spatial Query options useful for client side requests
org.apache.lucene.spatial.util Various spatial utilities.
org.apache.lucene.spatial.vector Spatial strategy that uses two fields.


The Spatial Module for Apache Lucene

The spatial module is new to Lucene 4, replacing the old "contrib" module that came before it. The principle interface to the module is a SpatialStrategy which encapsulates an approach to indexing and searching based on shapes. Different Strategies have different features and performance profiles, which are documented at each Strategy implementation class level.

For some sample code showing how to use the API, see in the tests.

The spatial module uses Spatial4j heavily. Spatial4j is an ASL licensed library with these capabilities:

Historical note: The new spatial module was once known as Lucene Spatial Playground (LSP) as an external project. In ~March 2012, LSP split into this new module as part of Lucene and Spatial4j externally. A large chunk of the LSP implementation originated as SOLR-2155 which uses trie/prefix-tree algorithms with a geohash encoding. That approach is implemented in RecursivePrefixTreeStrategy today.

Copyright © 2000-2013 Apache Software Foundation. All Rights Reserved.