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 directory
geode-examples/luceneSpatial
to be the current working directory. Each step in this example specifies paths relative to that directory. -
Build the example
$ ../gradlew build
-
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 theexample-region
region.$ gfsh run --file=scripts/start.gfsh
-
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 Example.java to see what this program does.
$ ../gradlew run
-
Shut down the cluster
$ gfsh run --file=scripts/stop.gfsh
-
Clean up any generated directories and files so this example can be rerun.
$ ../gradlew cleanServer