Search in sources :

Example 1 with PROPERTY_INDEX

use of org.apache.jackrabbit.oak.plugins.index.lucene.property.HybridPropertyIndexUtil.PROPERTY_INDEX in project jackrabbit-oak by apache.

the class HybridPropertyIndexLookup method query.

private Iterable<String> query(Filter filter, String propertyName, Set<String> encodedValues) {
    String propIdxNodeName = HybridPropertyIndexUtil.getNodeName(propertyName);
    NodeState propIndexRootNode = indexState.getChildNode(PROPERTY_INDEX);
    NodeState propIndexNode = propIndexRootNode.getChildNode(propIdxNodeName);
    if (!propIndexNode.exists()) {
        return Collections.emptyList();
    }
    String indexName = indexPath + "(" + propertyName + ")";
    Iterable<String> result;
    if (uniquePropertyIndex(propIndexNode)) {
        result = queryUnique(filter, indexName, propIndexRootNode, propIdxNodeName, encodedValues);
    } else {
        result = querySimple(filter, indexName, propIndexNode, encodedValues);
    }
    Iterable<String> paths = transform(result, path -> isAbsolute(path) ? path : "/" + path);
    if (log.isTraceEnabled()) {
        paths = transform(paths, path -> {
            log.trace("[{}] {} = {} -> {}", indexPath, propertyName, encodedValues, path);
            return path;
        });
    }
    return paths;
}
Also used : Iterables(com.google.common.collect.Iterables) Logger(org.slf4j.Logger) Iterables.transform(com.google.common.collect.Iterables.transform) PropertyValue(org.apache.jackrabbit.oak.api.PropertyValue) Type(org.apache.jackrabbit.oak.api.Type) LoggerFactory(org.slf4j.LoggerFactory) Set(java.util.Set) PropertyIndexUtil(org.apache.jackrabbit.oak.plugins.index.property.PropertyIndexUtil) PROP_PREVIOUS_BUCKET(org.apache.jackrabbit.oak.plugins.index.lucene.property.HybridPropertyIndexUtil.PROP_PREVIOUS_BUCKET) PropertyIndexUtil.encode(org.apache.jackrabbit.oak.plugins.index.property.PropertyIndexUtil.encode) Sets(com.google.common.collect.Sets) UniqueEntryStoreStrategy(org.apache.jackrabbit.oak.plugins.index.property.strategy.UniqueEntryStoreStrategy) PROPERTY_INDEX(org.apache.jackrabbit.oak.plugins.index.lucene.property.HybridPropertyIndexUtil.PROPERTY_INDEX) HybridPropertyIndexUtil.uniquePropertyIndex(org.apache.jackrabbit.oak.plugins.index.lucene.property.HybridPropertyIndexUtil.uniquePropertyIndex) PathUtils.isAbsolute(org.apache.jackrabbit.oak.commons.PathUtils.isAbsolute) Filter(org.apache.jackrabbit.oak.spi.query.Filter) NodeState(org.apache.jackrabbit.oak.spi.state.NodeState) PROP_HEAD_BUCKET(org.apache.jackrabbit.oak.plugins.index.lucene.property.HybridPropertyIndexUtil.PROP_HEAD_BUCKET) Collections(java.util.Collections) ValuePatternUtil(org.apache.jackrabbit.oak.plugins.index.property.ValuePatternUtil) ContentMirrorStoreStrategy(org.apache.jackrabbit.oak.plugins.index.property.strategy.ContentMirrorStoreStrategy) NodeState(org.apache.jackrabbit.oak.spi.state.NodeState)

Aggregations

Iterables (com.google.common.collect.Iterables)1 Iterables.transform (com.google.common.collect.Iterables.transform)1 Sets (com.google.common.collect.Sets)1 Collections (java.util.Collections)1 Set (java.util.Set)1 PropertyValue (org.apache.jackrabbit.oak.api.PropertyValue)1 Type (org.apache.jackrabbit.oak.api.Type)1 PathUtils.isAbsolute (org.apache.jackrabbit.oak.commons.PathUtils.isAbsolute)1 PROPERTY_INDEX (org.apache.jackrabbit.oak.plugins.index.lucene.property.HybridPropertyIndexUtil.PROPERTY_INDEX)1 PROP_HEAD_BUCKET (org.apache.jackrabbit.oak.plugins.index.lucene.property.HybridPropertyIndexUtil.PROP_HEAD_BUCKET)1 PROP_PREVIOUS_BUCKET (org.apache.jackrabbit.oak.plugins.index.lucene.property.HybridPropertyIndexUtil.PROP_PREVIOUS_BUCKET)1 HybridPropertyIndexUtil.uniquePropertyIndex (org.apache.jackrabbit.oak.plugins.index.lucene.property.HybridPropertyIndexUtil.uniquePropertyIndex)1 PropertyIndexUtil (org.apache.jackrabbit.oak.plugins.index.property.PropertyIndexUtil)1 PropertyIndexUtil.encode (org.apache.jackrabbit.oak.plugins.index.property.PropertyIndexUtil.encode)1 ValuePatternUtil (org.apache.jackrabbit.oak.plugins.index.property.ValuePatternUtil)1 ContentMirrorStoreStrategy (org.apache.jackrabbit.oak.plugins.index.property.strategy.ContentMirrorStoreStrategy)1 UniqueEntryStoreStrategy (org.apache.jackrabbit.oak.plugins.index.property.strategy.UniqueEntryStoreStrategy)1 Filter (org.apache.jackrabbit.oak.spi.query.Filter)1 NodeState (org.apache.jackrabbit.oak.spi.state.NodeState)1 Logger (org.slf4j.Logger)1