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);
}
Aggregations