public virtual void TestSortWithoutFillFields()
{
// There was previously a bug in TopFieldCollector when fillFields was set
// to false - the same doc and score was set in ScoreDoc[] array. this test
// asserts that if fillFields is false, the documents are set properly. It
// does not use Searcher's default search methods (with Sort) since all set
// fillFields to true.
Sort[] sort = new Sort[] { new Sort(SortField.FIELD_DOC), new Sort() };
for (int i = 0; i < sort.Length; i++)
{
Query q = new MatchAllDocsQuery();
TopDocsCollector<Entry> tdc = TopFieldCollector.Create(sort[i], 10, false, false, false, true);
@is.Search(q, tdc);
ScoreDoc[] sd = tdc.TopDocs().ScoreDocs;
for (int j = 1; j < sd.Length; j++)
{
Assert.IsTrue(sd[j].Doc != sd[j - 1].Doc);
}
}
}