Geode supports creating Lucene indexes on data in Geode regions. See the javadocs for and user guide for details on the API.
Internally, lucene indexes are stored in a region which is colocated with the user region. Geode provides an implementation of Lucene's Directory interface which stores lucene's data files directly in that colocated region, rather than on disk.
Lucene indexes are updated asynchronously by an AsyncEventQueue which is attached to the region.
Data flow into a lucene index
Implementation Details
Implementation Flowchart
...
PlantUML |
---|
[LuceneIndex] --> [RegionDirectory]
() "User"
node "Colocated Partitioned Regions" {
() User --> [User Data Region] : Puts
[User Data Region] --> [Async Queue]
[Async Queue] --> [LuceneIndex] : Batch Writes
[RegionDirectory] --> [Lucene Regions]
}
|
A closer look at Partitioned region data flow
...
In the case of partitioned regions, the query must be sent out to all the primaries. The results will then need to be aggregated back together. Lucene search uses FunctionService to distribute query to primaries.
Input to primaries
- Serialized Query
- CollectorManager to be used for local aggregation
- Result limit
Output from primaries
- Merged collector created from results of search on local bucket indexes.
PlantUML |
---|
participant LuceneQuery participant FunctionService participant FunctionCollector participant CollectorManager participant M1_LuceneFunction participant M1_CollectorManager participant Index_1 participant Index_2 LuceneQuery -> FunctionService: Query activate FunctionService FunctionService --> M1_LuceneFunction : LuceneContext activate M1_LuceneFunction FunctionService --> M2_LuceneFunction: LuceneContext activate M2_LuceneFunction M1_LuceneFunction -> Index_1 : search(Collector_1) Index_1 -> M1_LuceneFunction : loaded Collector_1 M1_LuceneFunction -> Index_2 : search(Collector_2) Index_2 -> M1_LuceneFunction : loaded Collector_2 M1_LuceneFunction -> M1_CollectorManager : merge Collectors activate M1_CollectorManager M1_CollectorManager -> M1_LuceneFunction : merged Collector deactivate M1_CollectorManager activate FunctionCollector M1_LuceneFunction -> FunctionCollector:Collector_M1 deactivate M1_LuceneFunction M2_LuceneFunction -> FunctionCollector:Collector_M2 deactivate M2_LuceneFunction FunctionCollector -> CollectorManager : merge Collectors activate CollectorManager CollectorManager -> FunctionCollector : Final Collector deactivate CollectorManager FunctionCollector -> FunctionService : Final Collector deactivate FunctionCollector FunctionService -> LuceneQuery : QueryResults deactivate FunctionService |