Class FilteringIndexStoreStrategy
- java.lang.Object
-
- org.apache.jackrabbit.oak.plugins.index.property.strategy.FilteringIndexStoreStrategy
-
- All Implemented Interfaces:
IndexStoreStrategy
public class FilteringIndexStoreStrategy extends java.lang.Object implements IndexStoreStrategy
A delegating IndexStoreStrategy that filters out updates that are not accepted by the given predicate
-
-
Constructor Summary
Constructors Constructor Description FilteringIndexStoreStrategy(IndexStoreStrategy strategy, Predicate<java.lang.String> filter)FilteringIndexStoreStrategy(IndexStoreStrategy strategy, Predicate<java.lang.String> filter, boolean readOnly)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description longcount(Filter filter, NodeState root, NodeState indexMeta, java.util.Set<java.lang.String> values, int max)Count the occurrence of a given set of values.longcount(NodeState root, NodeState indexMeta, java.util.Set<java.lang.String> values, int max)Count the occurrence of a given set of values.booleanexists(Supplier<NodeBuilder> index, java.lang.String key)Check whether an entry for the given key exists.java.lang.StringgetIndexNodeName()java.lang.Iterable<java.lang.String>query(Filter filter, java.lang.String indexName, NodeState indexMeta, java.lang.Iterable<java.lang.String> values)Search for a given set of values.voidupdate(Supplier<NodeBuilder> index, java.lang.String path, java.lang.String indexName, NodeBuilder indexMeta, java.util.Set<java.lang.String> beforeKeys, java.util.Set<java.lang.String> afterKeys)Updates the index for the given path.
-
-
-
Constructor Detail
-
FilteringIndexStoreStrategy
public FilteringIndexStoreStrategy(IndexStoreStrategy strategy, Predicate<java.lang.String> filter)
-
FilteringIndexStoreStrategy
public FilteringIndexStoreStrategy(IndexStoreStrategy strategy, Predicate<java.lang.String> filter, boolean readOnly)
-
-
Method Detail
-
update
public void update(Supplier<NodeBuilder> index, java.lang.String path, java.lang.String indexName, NodeBuilder indexMeta, java.util.Set<java.lang.String> beforeKeys, java.util.Set<java.lang.String> afterKeys) throws CommitFailedException
Description copied from interface:IndexStoreStrategyUpdates the index for the given path.- Specified by:
updatein interfaceIndexStoreStrategy- Parameters:
index- the index node supplierpath- path stored in the indexindexName- the name of the index. May be null.indexMeta- the definition of the index. May be null.beforeKeys- keys that no longer apply to the pathafterKeys- keys that now do apply to the path- Throws:
CommitFailedException
-
exists
public boolean exists(Supplier<NodeBuilder> index, java.lang.String key)
Description copied from interface:IndexStoreStrategyCheck whether an entry for the given key exists.- Specified by:
existsin interfaceIndexStoreStrategy- Parameters:
index- the index node supplierkey- the key- Returns:
- true if at least one entry exists
-
query
public java.lang.Iterable<java.lang.String> query(Filter filter, java.lang.String indexName, NodeState indexMeta, java.lang.Iterable<java.lang.String> values)
Description copied from interface:IndexStoreStrategySearch for a given set of values.- Specified by:
queryin interfaceIndexStoreStrategy- Parameters:
filter- the filter (can optionally be used for optimized query execution)indexName- the name of the index (for logging)indexMeta- the index metadata node (may not be null)values- values to look for (null to check for property existence)- Returns:
- an iterator of paths
-
count
public long count(NodeState root, NodeState indexMeta, java.util.Set<java.lang.String> values, int max)
Description copied from interface:IndexStoreStrategyCount the occurrence of a given set of values. Used in calculating the cost of an index.- Specified by:
countin interfaceIndexStoreStrategy- Parameters:
root- the root node (may not be null)indexMeta- the index metadata node (may not be null)values- values to look for (null to check for property existence)max- the maximum value to return- Returns:
- the aggregated count of occurrences for each provided value
-
count
public long count(Filter filter, NodeState root, NodeState indexMeta, java.util.Set<java.lang.String> values, int max)
Description copied from interface:IndexStoreStrategyCount the occurrence of a given set of values. Used in calculating the cost of an index.- Specified by:
countin interfaceIndexStoreStrategy- Parameters:
filter- the filter which can be used to estimate better costroot- the root node (may not be null)indexMeta- the index metadata node (may not be null)values- values to look for (null to check for property existence)max- the maximum value to return- Returns:
- the aggregated count of occurrences for each provided value
-
getIndexNodeName
public java.lang.String getIndexNodeName()
- Specified by:
getIndexNodeNamein interfaceIndexStoreStrategy
-
-