int first = first();
int max = max(first, queryHits.totalHits);
int size = max - first + 1 < 0 ? 0 : max - first + 1;
DocumentExtractor extractor = new DocumentExtractor(queryHits, searchFactory, indexProjection, idFieldNames, allowFieldSelectionInProjection);
List<String> keysForCache = new ArrayList<String>(size);
for (int index = first; index <= max; index++) {
// Since the documentId is same thing as the key in each key, value pairing. We can just get the documentId
// from Lucene and then get it from the cache.
// The extractor.extract.id gives me the documentId that we need.
String cacheKey = extractor.extract(index).id.toString(); // these are always strings
keysForCache.add(cacheKey);
}
// Loop through my list of keys and get it from the cache. Put each object that I get into a separate list.
List<Object> listToReturn = new ArrayList<Object>(size);