}
final Profiler profiler = _dynEnv.getProfiler();
final Iterator<Pair<DbCollection, String>> itor = ffcous.eachDocument();
while(itor.hasNext()) {
final Pair<DbCollection, String> pair = itor.next();
final DbCollection col = pair.getFirst();
final String docName = pair.getSecond();
final File idxFile = getIndexFile(col, docName);
BTreeIndexer indexer = new BTreeIndexer(idxFile);
final IndexMatch matched;
try {
matched = indexer.find(idxCond);
} catch (DbException e) {
throw new XQRTException("failed to query index: " + idxFile.getAbsolutePath(), e);
}
// TODO REVIEWME sort really required?
final long[] ptrs = filter(matched.getMatchedUnsorted(), docName, idxFile);
final int matchCounts = ptrs.length;
if(LOG.isInfoEnabled()) {
LOG.info("Index scan done. matched: " + matched.countMatched() + ", filtered: "
+ matchCounts);
}
if(matchCounts > 0) {
final IDocumentTable doctbl;
try {
doctbl = DocumentTableLoader.load(col, docName, _dynEnv);
} catch (IOException e) {
throw new XQRTException("failed to load document '" + docName
+ "' is the collection '" + col.getAbsolutePath() + '\'', e);
}
final PagingProfile profile = doctbl.getPagingProfile();
Strategy origStrategy = null;
if(profile != null) {
profile.setProfiler(profiler);