List<UserDocument> documents = new ArrayList<>();
for (UniqueId uniqueId : pair.getSecond()) {
documents.add(get(uniqueId));
}
UserSearchResult result = new UserSearchResult(documents);
result.setPaging(Paging.of(request.getPagingRequest(), pair.getFirst()));
// Debug: check result against underlying
if (EHCachingSearchCache.TEST_AGAINST_UNDERLYING) {
UserSearchResult check = ((UserMaster) getUnderlying()).search(request);
if (!result.getPaging().equals(check.getPaging())) {
s_logger.error("_documentSearchCache.getCache().getName() + \" returned paging:\\n\"" + result.getPaging() +
"\nbut the underlying master returned paging:\n" + check.getPaging());
}
if (!result.getDocuments().equals(check.getDocuments())) {
s_logger.error(_documentSearchCache.getCache().getName() + " returned documents:\n" + result.getDocuments() +
"\nbut the underlying master returned documents:\n" + check.getDocuments());
}
}
return result;
}