max_distance = ((IntegerValue)distance.eval(context, docs, nodes).convertTo(Type.INTEGER)).getInt();
max_distance = ((IntegerValue)distance.eval(docs, nodes).convertTo(Type.INTEGER)).getInt();
	public Sequence evalQuery(		StaticContext context,		DocumentSet docs,		String searchArg,		NodeSet nodes)		throws XPathException {		if(distance != null)			max_distance = ((IntegerValue)distance.eval(context, docs, nodes).convertTo(Type.INTEGER)).getInt();		try {			getSearchTerms(context, searchArg);		} catch (EXistException e) {			throw new XPathException(e.getMessage(), e);		}		NodeSet hits = processQuery(context, docs, nodes);		if (hits == null)			return Sequence.EMPTY_SEQUENCE;		LOG.debug("scanning " + hits.getLength() + " matches ...");						boolean hasWildcards = false;		for(int i = 0; i < terms.length; i++) {			hasWildcards =				NativeTextEngine.containsWildcards(terms[i]);		}		return hasWildcards			? patternMatch(context, hits)			: exactMatch(context, hits);	}