for (int q = 0; q < qnames.length; q++) {
for (final Iterator<Collection> i = docs.getCollectionIterator(); i.hasNext();) {
final int collectionId = (i.next()).getId();
final IndexQuery query;
if (start == null) {
final Value startRef = new QNameWordRef(collectionId, qnames[q],
broker.getBrokerPool().getSymbols());
query = new IndexQuery(IndexQuery.TRUNC_RIGHT, startRef);
} else if (end == null) {
final Value startRef = new QNameWordRef(collectionId, qnames[q],
start.toLowerCase(), broker.getBrokerPool().getSymbols());
query = new IndexQuery(IndexQuery.TRUNC_RIGHT, startRef);
} else {
final Value startRef = new QNameWordRef(collectionId, qnames[q], start.toLowerCase(),
broker.getBrokerPool().getSymbols());
final Value endRef = new QNameWordRef(collectionId, qnames[q], end.toLowerCase(),
broker.getBrokerPool().getSymbols());
query = new IndexQuery(IndexQuery.BW, startRef, endRef);
}
try {
lock.acquire(Lock.READ_LOCK);