return NodeSet.EMPTY_SET;
long start = System.currentTimeMillis();
// the expression can be called multiple times, so we need to clear the previous preselectResult
preselectResult = null;
LuceneIndexWorker index = (LuceneIndexWorker) context.getBroker().getIndexController().getWorkerByIndexId(LuceneIndex.ID);
// DW: contextSequence can be null
DocumentSet docs = contextSequence.getDocumentSet();
Item key = getKey(contextSequence, null);
List<QName> qnames = new ArrayList<>(1);
qnames.add(contextQName);
Properties options = parseOptions(contextSequence, null);
try {
if (Type.subTypeOf(key.getType(), Type.ELEMENT))
preselectResult = index.query(context, getExpressionId(), docs, useContext ? contextSequence.toNodeSet() : null,
qnames, (Element) ((NodeValue)key).getNode(), NodeSet.DESCENDANT, options);
else
preselectResult = index.query(context, getExpressionId(), docs, useContext ? contextSequence.toNodeSet() : null,
qnames, key.getStringValue(), NodeSet.DESCENDANT, options);
} catch (IOException | org.apache.lucene.queryparser.classic.ParseException e) {
throw new XPathException(this, "Error while querying full text index: " + e.getMessage(), e);
}
LOG.trace("Lucene query took " + (System.currentTimeMillis() - start));