Search in sources :

Example 16 with IndexSpec

use of org.exist.storage.IndexSpec in project exist by eXist-db.

the class GeneralComparison method checkForQNameIndex.

public static final IndexFlags checkForQNameIndex(IndexFlags idxflags, XQueryContext context, Sequence contextSequence, QName contextQName) {
    idxflags.reset(contextQName != null);
    for (final Iterator<Collection> i = contextSequence.getCollectionIterator(); i.hasNext(); ) {
        final Collection collection = i.next();
        if (collection.getURI().equalsInternal(XmldbURI.SYSTEM_COLLECTION_URI)) {
            continue;
        }
        final IndexSpec idxcfg = collection.getIndexConfiguration(context.getBroker());
        if (idxflags.indexOnQName && (idxcfg.getIndexByQName(contextQName) == null)) {
            idxflags.indexOnQName = false;
            if (LOG.isTraceEnabled()) {
                LOG.trace("cannot use index on QName: {}. Collection {} does not define an index", contextQName, collection.getURI());
            }
        }
        if (!idxflags.hasIndexOnQNames && idxcfg.hasIndexesByQName()) {
            idxflags.hasIndexOnQNames = true;
        }
        if (!idxflags.hasIndexOnPaths && idxcfg.hasIndexesByPath()) {
            idxflags.hasIndexOnPaths = true;
        }
    }
    return (idxflags);
}
Also used : IndexSpec(org.exist.storage.IndexSpec) Collection(org.exist.collections.Collection)

Aggregations

IndexSpec (org.exist.storage.IndexSpec)16 Collection (org.exist.collections.Collection)7 QName (org.exist.dom.QName)4 RangeIndexConfig (org.exist.indexing.range.RangeIndexConfig)2 Element (org.w3c.dom.Element)2 NamedNodeMap (org.w3c.dom.NamedNodeMap)2 NodeList (org.w3c.dom.NodeList)2 Connection (java.sql.Connection)1 SQLException (java.sql.SQLException)1 Analyzer (org.apache.lucene.analysis.Analyzer)1 IStoredNode (org.exist.dom.persistent.IStoredNode)1 Match (org.exist.dom.persistent.Match)1 NewArrayNodeSet (org.exist.dom.persistent.NewArrayNodeSet)1 NodeProxy (org.exist.dom.persistent.NodeProxy)1 NodeSet (org.exist.dom.persistent.NodeSet)1 RangeIndexConfigElement (org.exist.indexing.range.RangeIndexConfigElement)1 NodePath (org.exist.storage.NodePath)1 DatabaseConfigurationException (org.exist.util.DatabaseConfigurationException)1 Node (org.w3c.dom.Node)1