Class LuceneTemplate
java.lang.Object
org.springframework.data.gemfire.search.lucene.support.LuceneOperationsSupport
org.springframework.data.gemfire.search.lucene.LuceneAccessor
org.springframework.data.gemfire.search.lucene.support.LuceneAccessorSupport
org.springframework.data.gemfire.search.lucene.LuceneTemplate
- All Implemented Interfaces:
InitializingBean
,LuceneOperations
- Direct Known Subclasses:
ProjectingLuceneAccessor
LuceneTemplate
is a Lucene data access operations class encapsulating functionality
for performing Lucene queries and other Lucene data access operations.- Since:
- 1.1.0
- Author:
- John Blum
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.springframework.data.gemfire.search.lucene.LuceneAccessor
LuceneAccessor.LuceneQueryExecutor<T>
-
Field Summary
Fields inherited from interface org.springframework.data.gemfire.search.lucene.LuceneOperations
DEFAULT_PAGE_SIZE, DEFAULT_RESULT_LIMIT
-
Constructor Summary
ConstructorDescriptionConstructs an uninitialized instance ofLuceneTemplate
.LuceneTemplate
(String indexName, String regionPath) Constructs an instance ofLuceneTemplate
initialized with the given Luceneindex name
andfully-qualified Region path
.LuceneTemplate
(String indexName, Region<?, ?> region) LuceneTemplate
(LuceneIndex luceneIndex) Constructs an instance ofLuceneTemplate
initialized with the givenLuceneIndex
. -
Method Summary
Modifier and TypeMethodDescription<K,
V> List<LuceneResultStruct<K, V>> Executes the given Lucenequery
with a limit on the number of results returned.<K,
V> PageableLuceneQueryResults<K, V> Executes the given Lucenequery
with a limit on the number of results returned along with a page size for paging.<K,
V> List<LuceneResultStruct<K, V>> query
(LuceneQueryProvider queryProvider, int resultLimit) Executes the given Lucenequery
with a limit on the number of results returned.<K,
V> PageableLuceneQueryResults<K, V> query
(LuceneQueryProvider queryProvider, int resultLimit, int pageSize) Executes the given Lucenequery
with a limit on the number of results returned along with a page size for paging.<K> Collection<K>
queryForKeys
(String query, String defaultField, int resultLimit) Executes the given Lucenequery
returning aCollection
of keys matching the query clause/predicate with a limit on the number of keys returned.<K> Collection<K>
queryForKeys
(LuceneQueryProvider queryProvider, int resultLimit) Executes the given Lucenequery
returning aCollection
of keys matching the query clause/predicate with a limit on the number of keys returned.<V> Collection<V>
queryForValues
(String query, String defaultField, int resultLimit) Executes the given Lucenequery
returning aCollection
of values matching the query clause/predicate.<V> Collection<V>
queryForValues
(LuceneQueryProvider queryProvider, int resultLimit) Executes the given Lucenequery
returning aCollection
of values matching the query clause/predicate.Methods inherited from class org.springframework.data.gemfire.search.lucene.LuceneAccessor
afterPropertiesSet, createLuceneQueryFactory, createLuceneQueryFactory, createLuceneQueryFactory, doFind, getCache, getIndexName, getLuceneIndex, getLuceneService, getRegion, getRegionPath, resolveCache, resolveIndexName, resolveLuceneService, resolveLuceneService, resolveRegionPath, setCache, setIndexName, setLuceneIndex, setLuceneService, setRegion, setRegionPath
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.springframework.data.gemfire.search.lucene.LuceneOperations
query, query, queryForKeys, queryForKeys, queryForValues, queryForValues
-
Constructor Details
-
LuceneTemplate
public LuceneTemplate()Constructs an uninitialized instance ofLuceneTemplate
. -
LuceneTemplate
Constructs an instance ofLuceneTemplate
initialized with the givenLuceneIndex
.- Parameters:
luceneIndex
-LuceneIndex
used in Lucene queries.- See Also:
-
LuceneTemplate
- Parameters:
indexName
-String
containing the name of theLuceneIndex
.region
-Region
on which the Lucene query is executed.- See Also:
-
LuceneTemplate
Constructs an instance ofLuceneTemplate
initialized with the given Luceneindex name
andfully-qualified Region path
.- Parameters:
indexName
-String
containing the name of theLuceneIndex
.regionPath
-String
containing the fully-qualified path of theRegion
.
-
-
Method Details
-
query
public <K,V> List<LuceneResultStruct<K,V>> query(String query, String defaultField, int resultLimit) Description copied from interface:LuceneOperations
Executes the given Lucenequery
with a limit on the number of results returned.- Specified by:
query
in interfaceLuceneOperations
- Overrides:
query
in classLuceneAccessorSupport
- Type Parameters:
K
-Class
type of the key.V
-Class
type of the value.- Parameters:
query
-String
containing the Lucene query to execute.defaultField
-String
specifying the default field used in Lucene queries when a field is not explicitly defined in the Lucene query clause.resultLimit
- limit on the number of query results to return.- Returns:
- a
List
ofLuceneResultStruct
containing the query results. - See Also:
-
query
public <K,V> PageableLuceneQueryResults<K,V> query(String query, String defaultField, int resultLimit, int pageSize) Description copied from interface:LuceneOperations
Executes the given Lucenequery
with a limit on the number of results returned along with a page size for paging.- Specified by:
query
in interfaceLuceneOperations
- Overrides:
query
in classLuceneAccessorSupport
- Type Parameters:
K
-Class
type of the key.V
-Class
type of the value.- Parameters:
query
-String
containing the Lucene query to execute.defaultField
-String
specifying the default field used in Lucene queries when a field is not explicitly defined in the Lucene query clause.resultLimit
- limit on the number of query results to return.pageSize
- number of results per page.- Returns:
- a
PageableLuceneQueryResults
data structure containing the results of the Lucene query. - See Also:
-
query
public <K,V> List<LuceneResultStruct<K,V>> query(LuceneQueryProvider queryProvider, int resultLimit) Description copied from interface:LuceneOperations
Executes the given Lucenequery
with a limit on the number of results returned.- Specified by:
query
in interfaceLuceneOperations
- Overrides:
query
in classLuceneAccessorSupport
- Type Parameters:
K
-Class
type of the key.V
-Class
type of the value.- Parameters:
queryProvider
-LuceneQueryProvider
is a provider implementation supplying the Lucene query to execute as well as de/serialize to distribute across the cluster.resultLimit
- limit on the number of query results to return.- Returns:
- a
List
ofLuceneResultStruct
containing the query results. - See Also:
-
query
public <K,V> PageableLuceneQueryResults<K,V> query(LuceneQueryProvider queryProvider, int resultLimit, int pageSize) Description copied from interface:LuceneOperations
Executes the given Lucenequery
with a limit on the number of results returned along with a page size for paging.- Specified by:
query
in interfaceLuceneOperations
- Overrides:
query
in classLuceneAccessorSupport
- Type Parameters:
K
-Class
type of the key.V
-Class
type of the value.- Parameters:
queryProvider
-LuceneQueryProvider
is a provider implementation supplying the Lucene query to execute as well as de/serialize to distribute across the cluster.resultLimit
- limit on the number of query results to return.pageSize
- number of results per page.- Returns:
- a
PageableLuceneQueryResults
data structure containing the results of the Lucene query. - See Also:
-
queryForKeys
Description copied from interface:LuceneOperations
Executes the given Lucenequery
returning aCollection
of keys matching the query clause/predicate with a limit on the number of keys returned.- Specified by:
queryForKeys
in interfaceLuceneOperations
- Overrides:
queryForKeys
in classLuceneAccessorSupport
- Type Parameters:
K
-Class
type of the key.- Parameters:
query
-String
containing the Lucene query to execute.defaultField
-String
specifying the default field used in Lucene queries when a field is not explicitly defined in the Lucene query clause.resultLimit
- limit on the number of keys returned.- Returns:
- a
Collection
of keys matching the Lucene query clause (predicate). - See Also:
-
queryForKeys
Description copied from interface:LuceneOperations
Executes the given Lucenequery
returning aCollection
of keys matching the query clause/predicate with a limit on the number of keys returned.- Specified by:
queryForKeys
in interfaceLuceneOperations
- Overrides:
queryForKeys
in classLuceneAccessorSupport
- Type Parameters:
K
-Class
type of the key.- Parameters:
queryProvider
-LuceneQueryProvider
is a provider implementation supplying the Lucene query to execute as well as de/serialize to distribute across the cluster.resultLimit
- limit on the number of keys returned.- Returns:
- a
Collection
of keys matching the Lucene query clause (predicate). - See Also:
-
queryForValues
Description copied from interface:LuceneOperations
Executes the given Lucenequery
returning aCollection
of values matching the query clause/predicate.- Specified by:
queryForValues
in interfaceLuceneOperations
- Overrides:
queryForValues
in classLuceneAccessorSupport
- Type Parameters:
V
-Class
type of the value.- Parameters:
query
-String
containing the Lucene query to execute.defaultField
-String
specifying the default field used in Lucene queries when a field is not explicitly defined in the Lucene query clause.resultLimit
- limit on the number of values returned.- Returns:
- a
Collection
of values matching Lucene query clause (predicate). - See Also:
-
queryForValues
Description copied from interface:LuceneOperations
Executes the given Lucenequery
returning aCollection
of values matching the query clause/predicate.- Specified by:
queryForValues
in interfaceLuceneOperations
- Overrides:
queryForValues
in classLuceneAccessorSupport
- Type Parameters:
V
-Class
type of the value.- Parameters:
queryProvider
-LuceneQueryProvider
is a provider implementation supplying the Lucene query to execute as well as de/serialize to distribute across the cluster.resultLimit
- limit on the number of values returned.- Returns:
- a
Collection
of values matching Lucene query clause (predicate). - See Also:
-