{result = evalFallback(nodes, pattern, flags, indexType);}
if (result == null) {
final DocumentSet docs = nodes.getDocumentSet();
try {
final NativeValueIndex index = context.getBroker().getValueIndex();
hasUsedIndex = true;
//TODO : check index' case compatibility with flags' one ? -pb
if (context.isProfilingEnabled())
{context.getProfiler().message(this, Profiler.OPTIMIZATIONS, "Using vlaue index '" + index.toString() + "'", "Regex: " + pattern);}
if (LOG.isTraceEnabled())
{LOG.trace("Using range index for fn:matches expression: " + pattern);}
if (indexScan)
{result = index.matchAll(context.getWatchDog(), docs, nodes, NodeSet.ANCESTOR, pattern, DBBroker.MATCH_REGEXP, flags, caseSensitive);}
else
{result = index.match(context.getWatchDog(), docs, nodes, NodeSet.ANCESTOR, pattern, contextQName, DBBroker.MATCH_REGEXP, flags, caseSensitive);}
} catch (final EXistException e) {
throw new XPathException(this, e);
}
}
} else {