private void checkHits(ScoreDoc[] hits, int expectedCount, IndexSearcher searcher) throws IOException { assertEquals("total results", expectedCount, hits.length); for (int i = 0; i < hits.length; i++) { if (i < 10 || (i > 94 && i < 105)) { Document d = searcher.doc(hits[i].doc); assertEquals("check " + i, String.valueOf(i), d.get(ID_FIELD)); } } }
private void printHits(PrintWriter out, ScoreDoc[] hits, IndexSearcher searcher) throws IOException { out.println(hits.length + " total results\n"); for (int i = 0; i < hits.length; i++) { if (i < 10 || (i > 94 && i < 105)) { Document d = searcher.doc(hits[i].doc); out.println(i + " " + d.get(ID_FIELD)); } } }