NodeSet result; if (contextSet == null) result = new TextSearchResult(trackMatches != Serializer.TAG_NONE); else result = new ExtArrayNodeSet();
NodeSet result = new ExtArrayNodeSet();
	public NodeSet getNodes(XQueryContext context, DocumentSet docs, NodeSet contextSet,							TermMatcher matcher, CharSequence startTerm) throws TerminatedException {//		long start = System.currentTimeMillis();		NodeSet result;		if (contextSet == null)			result = new TextSearchResult(trackMatches != Serializer.TAG_NONE);		else			result = new ExtArrayNodeSet();		Value ref;		Collection collection;		short collectionId;		SearchCallback cb;		Lock lock = dbWords.getLock();		cb = new SearchCallback(context, matcher, result, contextSet, docs);		for (Iterator iter = docs.getCollectionIterator(); iter.hasNext();) {			collection = (Collection) iter.next();			collectionId = collection.getId();			if (startTerm != null && startTerm.length() > 0)				ref = new WordRef(collectionId, startTerm.toString().toLowerCase());			else				ref = new WordRef(collectionId);			IndexQuery query = new IndexQuery(IndexQuery.TRUNC_RIGHT, ref);			try {				lock.acquire();				try {					dbWords.query(query, cb);				} catch (IOException ioe) {					LOG.debug(ioe);				} catch (BTreeException bte) {					LOG.debug(bte);				}			} catch (LockException e) {				LOG.debug(e);			} finally {				lock.release();			}		}//		LOG.debug("regexp found: " + result.getLength() + " in "//				+ (System.currentTimeMillis() - start) + "ms.");		return result;	}