for (int i = 0; i < 100; i++) {
// Now we redo the search, but limit the max number of hits. We expect the
// same ordering of hits.
for (int maxHits = 1; maxHits < expectedHits.size() + 1; maxHits++) {
final Hits hits = client.search(query, new String[] { INDEX_NAME }, maxHits);
assertNotNull(hits);
assertEquals(maxHits, hits.getHits().size());
for (int j = 0; j < hits.getHits().size(); j++) {
// writeToLog("expected: ", expectedHits.getHits().get(j));
// writeToLog("actual : ", hits.getHits().get(j));