Package org.apache.geode.cache.lucene
Interface LuceneQuery<K,V>
public interface LuceneQuery<K,V>
A query on a Lucene index. Instances of this interface are created using
LuceneQueryFactory.create(java.lang.String, java.lang.String, java.lang.String, java.lang.String). Once this query is constructed, use one of the find methods to
find region entries that match this query.
Instances obtained from LuceneQueryFactory are immutable, so they are safe for reuse and
can be shared by multiple threads.
Because Lucene indexes are maintained asynchronously, results returned from the find methods may not reflect the most recent updates to the region.
Results are returned in order of their score with respect to this query.
-
Method Summary
Modifier and TypeMethodDescriptionfindKeys()Execute the query and return the region keys that match this query, up to the limit specified bygetLimit().Execute the query and get aPageableLuceneQueryResults.Execute the query and return a list ofLuceneResultStructs that match this query, up to the limit specified bygetLimit()ALuceneResultStructcontains the region key, value, and a score for that entry.Execute the query and return the region values that match this query, up to the limit specified bygetLimit()intgetLimit()Get limit size setting of current query.intGets the page size setting of current query.
-
Method Details
-
findKeys
Execute the query and return the region keys that match this query, up to the limit specified bygetLimit().- Returns:
- Collection of Apache Geode region keys that satisfy the Lucene query.
- Throws:
LuceneQueryException- if the query could not be parsed or executed.CacheClosedException- if the cache was closed while the Lucene query was being executed.FunctionException- if the function execution mechanism encounters an error while executing the Lucene query.PartitionOfflineException- if the node containing the buckets required to execute the Lucene query goes offline.CancelException- if a cancel is in progress while the Lucene query was being executed.
-
findValues
Execute the query and return the region values that match this query, up to the limit specified bygetLimit()- Returns:
- a Collection of Apache Geode region values that satisfy the Lucene query.
- Throws:
LuceneQueryException- if the query could not be parsed or executed.CacheClosedException- if the cache was closed while the Lucene query was being executed.FunctionException- if the function execution mechanism encounters an error while executing the Lucene query.PartitionOfflineException- if the node containing the buckets required to execute the Lucene query goes offline.CancelException- if a cancel is in progress while the Lucene query was being executed.
-
findResults
Execute the query and return a list ofLuceneResultStructs that match this query, up to the limit specified bygetLimit()ALuceneResultStructcontains the region key, value, and a score for that entry.- Returns:
- a List of LuceneResultStruct that match the Lucene query
- Throws:
LuceneQueryException- if the query could not be parsed or executed.CacheClosedException- if the cache was closed while the Lucene query was being executed.FunctionException- if the function execution mechanism encounters an error while executing the Lucene query.PartitionOfflineException- if the node containing the buckets required to execute the Lucene query goes offline.CancelException- if a cancel is in progress while the Lucene query was being executed.
-
findPages
Execute the query and get aPageableLuceneQueryResults. ThePageableLuceneQueryResultsprovides the ability to fetch a page of results at a time, as specified bygetPageSize()- Returns:
- a PageableLuceneQuery that can be used to fetch one page of result at a time.
- Throws:
LuceneQueryException- if the query could not be parsed or executed.CacheClosedException- if the cache was closed while the Lucene query was being executed.FunctionException- if the function execution mechanism encounters an error while executing the Lucene query.PartitionOfflineException- if the node containing the buckets required to execute the Lucene query goes offline.CancelException- if a cancel is in progress while the Lucene query was being executed.
-
getPageSize
int getPageSize()Gets the page size setting of current query. This page size is set while creatingLuceneQueryImplobject- Returns:
- int value representing the page size of the current query
-
getLimit
int getLimit()Get limit size setting of current query. This value is the maximum number of results that can be returned by the Lucene query. This value is set while creating theLuceneQueryImplobject- Returns:
- int value representing the limit of the current query
-