Class UniqueEntryStoreStrategy
- java.lang.Object
-
- org.apache.jackrabbit.oak.plugins.index.property.strategy.UniqueEntryStoreStrategy
-
- All Implemented Interfaces:
IndexStoreStrategy
public class UniqueEntryStoreStrategy extends Object implements IndexStoreStrategy
An IndexStoreStrategy implementation that saves the unique node in a single property.
This should reduce the number of nodes in the repository, and speed up access.
For example for a node that is under/test/node
, the index structure will be/oak:index/index/@key
:
-
-
Constructor Summary
Constructors Constructor Description UniqueEntryStoreStrategy()
UniqueEntryStoreStrategy(String indexName)
UniqueEntryStoreStrategy(String indexName, @NotNull Consumer<NodeBuilder> insertCallback)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description long
count(Filter filter, NodeState root, NodeState indexMeta, Set<String> values, int max)
Count the occurrence of a given set of values.long
count(NodeState root, NodeState indexMeta, Set<String> values, int max)
Count the occurrence of a given set of values.boolean
exists(Supplier<NodeBuilder> index, String key)
Check whether an entry for the given key exists.String
getIndexNodeName()
Iterable<String>
query(Filter filter, String indexName, NodeState indexMeta, Iterable<String> values)
Search for a given set of values.Iterable<IndexEntry>
queryEntries(Filter filter, String indexName, NodeState indexMeta, Iterable<String> values)
Search for a given set of values, returning IndexEntry resultsvoid
update(Supplier<NodeBuilder> index, String path, @Nullable String indexName, @Nullable NodeBuilder indexMeta, Set<String> beforeKeys, Set<String> afterKeys)
Updates the index for the given path.
-
-
-
Constructor Detail
-
UniqueEntryStoreStrategy
public UniqueEntryStoreStrategy()
-
UniqueEntryStoreStrategy
public UniqueEntryStoreStrategy(String indexName)
-
UniqueEntryStoreStrategy
public UniqueEntryStoreStrategy(String indexName, @NotNull @NotNull Consumer<NodeBuilder> insertCallback)
-
-
Method Detail
-
update
public void update(Supplier<NodeBuilder> index, String path, @Nullable @Nullable String indexName, @Nullable @Nullable NodeBuilder indexMeta, Set<String> beforeKeys, Set<String> afterKeys)
Description copied from interface:IndexStoreStrategy
Updates the index for the given path.- Specified by:
update
in 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
-
query
public Iterable<String> query(Filter filter, String indexName, NodeState indexMeta, Iterable<String> values)
Description copied from interface:IndexStoreStrategy
Search for a given set of values.- Specified by:
query
in 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
-
queryEntries
public Iterable<IndexEntry> queryEntries(Filter filter, String indexName, NodeState indexMeta, Iterable<String> values)
Search for a given set of values, returning IndexEntry results- 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 index entries
- Throws:
UnsupportedOperationException
- if the operation is not supported
-
exists
public boolean exists(Supplier<NodeBuilder> index, String key)
Description copied from interface:IndexStoreStrategy
Check whether an entry for the given key exists.- Specified by:
exists
in interfaceIndexStoreStrategy
- Parameters:
index
- the index node supplierkey
- the key- Returns:
- true if at least one entry exists
-
count
public long count(NodeState root, NodeState indexMeta, Set<String> values, int max)
Description copied from interface:IndexStoreStrategy
Count the occurrence of a given set of values. Used in calculating the cost of an index.- Specified by:
count
in 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, Set<String> values, int max)
Description copied from interface:IndexStoreStrategy
Count the occurrence of a given set of values. Used in calculating the cost of an index.- Specified by:
count
in 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 String getIndexNodeName()
- Specified by:
getIndexNodeName
in interfaceIndexStoreStrategy
-
-