final List<CloseableIterator<?>> results = new ArrayList<CloseableIterator<?>>();
int indexCount = 0;
// all queries will use the same instance of the dedupe filter for
// client side filtering because the filter needs to be applied across
// indices
final MultiIndexDedupeFilter clientDedupeFilter = new MultiIndexDedupeFilter();
while (indices.hasNext()) {
final Index index = indices.next();
final AccumuloConstraintsQuery accumuloQuery;
if (query == null) {
accumuloQuery = new AccumuloConstraintsQuery(
adapterIds,
index,
clientDedupeFilter);
}
else if (query.isSupported(index)) {
// construct the query
accumuloQuery = new AccumuloConstraintsQuery(
adapterIds,
index,
query.getIndexConstraints(index.getIndexStrategy()),
query.createFilters(index.getIndexModel()),
clientDedupeFilter,
authorizations);
}
else {
continue;
}
results.add(accumuloQuery.query(
accumuloOperations,
adapterStore,
limit,
true));
indexCount++;
}
// if there aren't multiple indices, the client-side dedupe filter can
// just cache rows that are duplicated within the index and not
// everything
clientDedupeFilter.setMultiIndexSupportEnabled(indexCount > 1);
// concatenate iterators
return new CloseableIteratorWrapper<Object>(
new Closeable() {
@Override
public void close()