db.query(query, cb);
db.query(query, prefix, cb);
    public ValueOccurrences[] scanIndexKeys(DocumentSet docs, NodeSet contextSet,            Indexable start, Indexable end) {        long t0 = System.currentTimeMillis();        final Lock lock = db.getLock();        short collectionId;        Collection current;        IndexQuery query;        int type = ((Item) start).getType();        IndexScanCallback cb = new IndexScanCallback(docs, contextSet, type);        for (Iterator i = docs.getCollectionIterator(); i.hasNext();) {            current = (Collection) i.next();            collectionId = current.getId();            byte[] startKey = start.serialize(collectionId, caseSensitive);            if (end == null)                query = new IndexQuery(IndexQuery.GEQ, new Value(startKey));            else {                byte[] endKey = end.serialize(collectionId, caseSensitive);                query = new IndexQuery(IndexQuery.BW, new Value(startKey),                         new Value(endKey));            }            try {                lock.acquire();                db.query(query, cb);            } catch (LockException e) {                LOG.warn("cannot get lock on words", e);            } catch (IOException e) {                LOG.warn("error while reading words", e);            } catch (BTreeException e) {                LOG.warn("error while reading words", e);            } catch (TerminatedException e) {                LOG.warn("Method terminated", e);            } finally {                lock.release();            }        }        Map map = cb.map;        ValueOccurrences[] result = new ValueOccurrences[map.size()];        LOG.debug("Found " + result.length + " in " + (System.currentTimeMillis() - t0));        return (ValueOccurrences[]) map.values().toArray(result);    }