Geode Lucene Spatial Indexing Example

This examples demonstrates how to use Geode's LuceneSerializer and LuceneQueryProvider APIs to customize how Geode data is stored and indexed in Lucene.

In this example two servers host a partitioned region that stores train station stop information, including GPS coordinates. The region has lucene index that allows spatial queries to be performed against the data. The example shows how to do a spatial query to find nearby train stations.

This example assumes that Java and Geode are installed.

Set up the Lucene index and region

  1. Set directory geode-examples/luceneSpatial to be the current working directory. Each step in this example specifies paths relative to that directory.

  2. Build the example

     $ ../gradlew build
  3. Run a script that starts a locator and two servers, creates a Lucene index called simpleIndex with a custom LuceneSerializer that indexes spatial data. The script then creates the example-region region.

     $ gfsh run --file=scripts/start.gfsh
  4. Run the example. This program adds data to the example-region, and then looks for train stations with a 1 mile of a specific GPS coordinate. Look at to see what this program does.

     $ ../gradlew run
  5. Shut down the cluster

     $ gfsh run --file=scripts/stop.gfsh
  6. Clean up any generated directories and files so this example can be rerun.

     $ ../gradlew cleanServer