public override TopDocs Search(Weight weight, Filter filter, int nDocs)
{
HitQueue hq = new HitQueue(nDocs, false);
int totalHits = 0;
var lockObj = new object();
for (int i = 0; i < searchables.Length; i++)
{
// search each searcher
// use NullLock, we don't care about synchronization for these
TopDocs docs = MultiSearcherCallableNoSort(ThreadLock.NullLock, lockObj, searchables[i], weight, filter, nDocs, hq, i, starts);
totalHits += docs.TotalHits; // update totalHits
}
ScoreDoc[] scoreDocs2 = new ScoreDoc[hq.Size()];
for (int i = hq.Size() - 1; i >= 0; i--)
// put docs in array
scoreDocs2[i] = hq.Pop();
float maxScore = (totalHits == 0)?System.Single.NegativeInfinity:scoreDocs2[0].Score;
return new TopDocs(totalHits, scoreDocs2, maxScore);
}