Products
Clients
Extensions
APIs
These examples demonstrate how to use GemFire's LuceneSerializer and LuceneQueryProvider APIs to customize how GemFire data is stored and indexed in Lucene.
All the examples are run from Example.java class’s main method. In these example two servers host a partitioned region that stores the location information,including GPS coordinates. The region has lucene index that allows spatial queries to be performed against the data.
These examples show how to do a spatial query:
First example is SearchNearestResultExample, it finds nearby locations from a specific location.
Second example is DistanceFacetsExample, it finds all the locations which coincides with the given location.
Third example is SearchOverlappingLocation, it finds the location that overlaps with other locations.
Fourth example is SearchIntersectingCoordinates, it finds the location that coincides with a given shape (which consists of multiple locations).
These examples assume that Java 11 and GemFire are installed. Minimum java version is jdk11. Note: These example use the GemFire Search extension which requires GemFire 10 to work
These examples assume that Java 11 and GemFire are installed. Minimum java version is jdk11.
Note: These example use the GemFire Search extension which requires GemFire 10 to work
Set directory gemfire-examples/luceneSpatial to be the current working directory. Each step in this example specifies paths relative to that directory.
gemfire-examples/luceneSpatial
Build the examples
$ ../gradlew build
Add VMware GemFire Search extension path to the GEMFIRE_EXTENSIONS_REPOSITORY_PATH environment variable. For example, if your vmware-gemfire-search-.gfm file is located in /gemfire-extensions, use the following command:
GEMFIRE_EXTENSIONS_REPOSITORY_PATH
$ export GEMFIRE_EXTENSIONS_REPOSITORY_PATH=/gemfire-extensions
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.
simpleIndex
example-region
$ gfsh run --file=scripts/start.gfsh
Run the examples to populate both the Lucene index and example-region. This program adds data to the example-region, and then performs the searches mentioned above.
$ ../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