public void execute(DocumentMap dm) {
        init(dm);
        if (key != null) {
            valueType = documentMap.getDocumentType().getType(key);
        }
        while (true) {
            if ((limit != 0) && (candidates.size() == limit)) {
                return;
            }
            candidate = indexGlobal.nextSubscript(candidate);
            if (candidate.equals("")) {
                break;
            }
            if (!apply(ElementType.cast(candidate,valueType))) {
                continue;
            }
            // multiple index values
            if (uniqueIndex) { //(indexGlobal.hasSubnodes(candidate)) {
                candidates.add(indexGlobal.getString(candidate));
            } else {
                ValueList indexList = indexGlobal.getList(candidate);
                for (int i=0;i<indexList.length();i++) {
                    candidates.add(indexList.getNextString());
                }
            }
        }
        candidateIt = candidates.iterator();
    }