public final static 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: " + contextQName + ". Collection " + collection.getURI() + " does not define an index" );
}
}
if( !idxflags.hasIndexOnQNames && idxcfg.hasIndexesByQName() ) {
idxflags.hasIndexOnQNames = true;