K
- the type of keys the predicate operates on.V
- the type of values the predicate operates on.public interface IndexAwarePredicate<K,V> extends Predicate<K,V>
Predicate
interface with the ability to support indexes.
The general contract is:
isIndexed(com.hazelcast.query.impl.QueryContext)
method of the index-aware predicate and provides it with the
QueryContext
instance. The predicate may consult the passed query
context regarding the indexes configured for the map in question and decide
whether it is possible to use the indexes to speed up the query processing or
not.
filter(com.hazelcast.query.impl.QueryContext)
method
is invoked by the query engine to obtain a filtered entry set. The query
engine assumes that this obtained result set is consistent with the entry set
at the time the result set was produced. In other words, all the entries for
which the predicate evaluates
to true
are included in
the result set and all the entries for which the predicate evaluates to
false
are excluded from the result set.
Predicate.apply(java.util.Map.Entry<K, V>)
method of the predicate.
Modifier and Type | Method and Description |
---|---|
Set<QueryableEntry<K,V>> |
filter(QueryContext queryContext)
Produces a filtered entry set by utilizing the indexes available while
executing the query in the given query context.
|
boolean |
isIndexed(QueryContext queryContext)
Signals to the query engine that this predicate is able to utilize the
indexes available while executing the query in the given query context.
|
Set<QueryableEntry<K,V>> filter(QueryContext queryContext)
The query engine assumes this method produces the result set faster than a simple evaluation of the predicate on every entry.
queryContext
- the query context to access the indexes. The passed
query context is valid only for a duration of a single
call to the method.boolean isIndexed(QueryContext queryContext)
queryContext
- the query context to consult for the available
indexes.true
if this predicate is able to use the indexes to
speed up the processing, false
otherwise.Copyright © 2019 Hazelcast, Inc.. All Rights Reserved.