Search in sources :

Example 1 with RangeIndexConfig

use of org.exist.indexing.range.RangeIndexConfig in project exist by eXist-db.

the class FieldLookup method getType.

public int getType(Sequence contextSequence, String field) {
    if (contextSequence == null) {
        return Type.ITEM;
    }
    for (final Iterator<Collection> i = contextSequence.getCollectionIterator(); i.hasNext(); ) {
        final Collection collection = i.next();
        if (collection.getURI().startsWith(XmldbURI.SYSTEM_COLLECTION_URI)) {
            continue;
        }
        IndexSpec idxConf = collection.getIndexConfiguration(context.getBroker());
        if (idxConf != null) {
            RangeIndexConfig config = (RangeIndexConfig) idxConf.getCustomIndexSpec(RangeIndex.ID);
            if (config != null) {
                int type = config.getType(field);
                if (type != Type.ITEM) {
                    return type;
                }
            }
        }
    }
    return Type.ITEM;
}
Also used : IndexSpec(org.exist.storage.IndexSpec) Collection(org.exist.collections.Collection) RangeIndexConfig(org.exist.indexing.range.RangeIndexConfig)

Example 2 with RangeIndexConfig

use of org.exist.indexing.range.RangeIndexConfig in project exist by eXist-db.

the class Lookup method findConfiguration.

private RangeIndexConfigElement findConfiguration(Sequence contextSequence) {
    NodePath path = contextPath;
    if (path == null) {
        if (contextQName == null) {
            return null;
        }
        path = new NodePath(contextQName);
    }
    for (final Iterator<Collection> i = contextSequence.getCollectionIterator(); i.hasNext(); ) {
        final Collection collection = i.next();
        if (collection.getURI().startsWith(XmldbURI.SYSTEM_COLLECTION_URI)) {
            continue;
        }
        IndexSpec idxConf = collection.getIndexConfiguration(context.getBroker());
        if (idxConf != null) {
            RangeIndexConfig config = (RangeIndexConfig) idxConf.getCustomIndexSpec(RangeIndex.ID);
            if (config != null) {
                RangeIndexConfigElement rice = config.find(path);
                if (rice != null && !rice.isComplex()) {
                    return rice;
                }
            }
        }
    }
    return null;
}
Also used : IndexSpec(org.exist.storage.IndexSpec) RangeIndexConfigElement(org.exist.indexing.range.RangeIndexConfigElement) Collection(org.exist.collections.Collection) RangeIndexConfig(org.exist.indexing.range.RangeIndexConfig) NodePath(org.exist.storage.NodePath)

Aggregations

Collection (org.exist.collections.Collection)2 RangeIndexConfig (org.exist.indexing.range.RangeIndexConfig)2 IndexSpec (org.exist.storage.IndexSpec)2 RangeIndexConfigElement (org.exist.indexing.range.RangeIndexConfigElement)1 NodePath (org.exist.storage.NodePath)1