public final class IndexQuery<K,V> extends Query<javax.cache.Cache.Entry<K,V>>
QueryCursor
delivers sorted cache entries by the order defined for queried index.
IndexQuery
has to be initialized with cache value class or type. The algorithm of discovering index is as follows:
1. If idxName
is set, then use it.
2. If idxName
is not set, then find an index that matches criteria fields.
3. If neither idxName
, nor setCriteria(List)
is used, then perform index scan over PK index for specified Value type.
Conjuction of items in criteria
has to represent a valid range to traverse the index tree.DFLT_PAGE_SIZE
Constructor and Description |
---|
IndexQuery(Class<?> valCls)
Specify index with cache value class.
|
IndexQuery(Class<?> valCls,
@Nullable String idxName)
Specify index with cache value class and index name.
|
IndexQuery(String valType)
Specify index with cache value type.
|
IndexQuery(String valType,
@Nullable String idxName)
Specify index with cache value type and index name.
|
Modifier and Type | Method and Description |
---|---|
List<IndexQueryCriterion> |
getCriteria()
Index query criteria.
|
IgniteBiPredicate<K,V> |
getFilter()
Gets remote cache entries filter.
|
String |
getIndexName()
Index name.
|
int |
getLimit()
Gets limit to response records count.
|
@Nullable Integer |
getPartition()
Gets partition number over which this query should iterate.
|
String |
getValueType()
Cache Value type.
|
IndexQuery<K,V> |
setCriteria(IndexQueryCriterion... criteria)
Sets conjunction (AND) criteria for index query.
|
IndexQuery<K,V> |
setCriteria(List<IndexQueryCriterion> criteria)
Sets conjunction (AND) criteria for index query.
|
IndexQuery<K,V> |
setFilter(IgniteBiPredicate<K,V> filter)
Sets remote cache entries filter.
|
IndexQuery<K,V> |
setLimit(int limit)
Sets limit to response records count.
|
IndexQuery<K,V> |
setPartition(@Nullable Integer part)
Sets partition number over which this query should iterate.
|
getPageSize, isLocal, prepare, setLocal, setPageSize, toString
public IndexQuery(Class<?> valCls)
valCls
- Cache value class.public IndexQuery(String valType)
valType
- Cache value type.public IndexQuery(Class<?> valCls, @Nullable @Nullable String idxName)
valCls
- Cache value class.idxName
- Index name.public IndexQuery<K,V> setCriteria(IndexQueryCriterion... criteria)
criteria
- Criteria to set.this
for chaining.public IndexQuery<K,V> setCriteria(List<IndexQueryCriterion> criteria)
criteria
- Criteria to set.this
for chaining.public List<IndexQueryCriterion> getCriteria()
public String getValueType()
public String getIndexName()
public int getLimit()
public IndexQuery<K,V> setLimit(int limit)
limit
- POsitive limit to set.this
For chaining.public IndexQuery<K,V> setFilter(IgniteBiPredicate<K,V> filter)
filter
- Predicate for remote filtering of query result cursor.this
for chaining.public IgniteBiPredicate<K,V> getFilter()
public IndexQuery<K,V> setPartition(@Nullable @Nullable Integer part)
null
, query will iterate over
all partitions in the cache. Must be in the range [0, N) where N is partition number in the cache.part
- Partition number over which this query should iterate.this
for chaining.@Nullable public @Nullable Integer getPartition()
null
if partition was not
set. In this case query will iterate over all partitions in the cache.null
.
Follow @ApacheIgnite
Ignite Database and Caching Platform : ver. 2.16.0 Release Date : December 15 2023