PageResult pageResult,
CloseableIterator<String> idx) throws IOException
{
String searchKey = null;
ZipNumParams params = new ZipNumParams(defaultParams);
// Opt: testing out sequential load!
if (Math.abs(query.limit) == 1) {
params.setSequential(true);
}
params.setReverse(query.isReverse());
if (!query.resumeKey.isEmpty()) {
searchKey = URLDecoder.decode(query.resumeKey, "UTF-8");
startEndUrl[0] = searchKey;
// int lastSpace = startEndUrl[0].lastIndexOf(' ');
// if (lastSpace > 0) {
// startEndUrl[0] = searchKey.substring(0, lastSpace);
// }
} else if (!query.from.isEmpty()) {
searchKey = startEndUrl[0] + " " + query.from;
} else if (query.isReverse() && !query.closest.isEmpty()) {
searchKey = startEndUrl[0];
startEndUrl[1] = startEndUrl[0] + " " + query.closest;
} else if (query.fastLatest) {
String endkey = (query.closest.isEmpty() ? "!" : " " + query.closest);
params.setMaxAggregateBlocks(1);
searchKey = startEndUrl[0] + endkey;
} else {
searchKey = startEndUrl[0];
}
if (pageResult != null) {
params.setTimestampDedupLength(0);
return zipnumSource.getCDXIterator(idx, searchKey, startEndUrl[1], query.page, pageResult.numPages, params);
} else {
return cdxSource.getCDXIterator(searchKey, startEndUrl[0], startEndUrl[1], params);
}
}