public static void DoCheckHits(Random random, Query query, string defaultFieldName, IndexSearcher searcher, int[] results, Similarity similarity)
{
ScoreDoc[] hits = searcher.Search(query, 1000).ScoreDocs;
SortedSet<int?> correct = new SortedSet<int?>();
for (int i = 0; i < results.Length; i++)
{
correct.Add(Convert.ToInt32(results[i]));
}
SortedSet<int?> actual = new SortedSet<int?>();
for (int i = 0; i < hits.Length; i++)
{
actual.Add(Convert.ToInt32(hits[i].Doc));
}
Assert.AreEqual(correct, actual, query.ToString(defaultFieldName));
QueryUtils.Check(random, query, searcher, LuceneTestCase.Rarely(random), similarity);
}