.scanIndexTerms(docs, nodes, (Indexable) args[1], null);
.scanIndexKeys(docs, nodes, (Indexable) args[1], null);
    public Sequence eval(Sequence[] args, Sequence contextSequence)            throws XPathException {        if (args[0].getLength() == 0)            return Sequence.EMPTY_SEQUENCE;        NodeSet nodes = args[0].toNodeSet();        DocumentSet docs = nodes.getDocumentSet();        FunctionReference ref = (FunctionReference) args[2].itemAt(0);        int max = ((IntegerValue) args[3].itemAt(0)).getInt();        FunctionCall call = ref.getFunctionCall();        Sequence result = new ValueSequence();        ValueOccurrences occur[] = context.getBroker().getValueIndex()                .scanIndexTerms(docs, nodes, (Indexable) args[1], null);        int len = (occur.length > max ? max : occur.length);        Sequence params[] = new Sequence[2];        ValueSequence data = new ValueSequence();        for (int j = 0; j < len; j++) {            params[0] = occur[j].getValue();            data.add(new IntegerValue(occur[j].getOccurrences(),                    Type.UNSIGNED_INT));            data.add(new IntegerValue(occur[j].getDocuments(),                    Type.UNSIGNED_INT));            data.add(new IntegerValue(j + 1, Type.UNSIGNED_INT));            params[1] = data;            result.addAll(call.evalFunction(contextSequence, null, params));            data.clear();        }        LOG.debug("Returning: " + result.getLength());        return result;    }