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