protected internal override TopDocs NewTopDocs(ScoreDoc[] results, int start) { if (results == null) { return(EMPTY_TOPDOCS); } // We need to compute maxScore in order to set it in TopDocs. If start == 0, // it means the largest element is already in results, use its score as // maxScore. Otherwise pop everything else, until the largest element is // extracted and use its score as maxScore. float maxScore = float.NaN; if (start == 0) { maxScore = results[0].Score; } else { for (int i = Pq.Size(); i > 1; i--) { Pq.Pop(); } maxScore = Pq.Pop().Score; } return(new TopDocs(TotalHits_Renamed, results, maxScore)); }
protected internal override TopDocs NewTopDocs(ScoreDoc[] results, int start) { if (results == null) { return(EMPTY_TOPDOCS); } float maxScore = float.NaN; if (start == 0) { maxScore = results[0].Score; } else { for (int i = Pq.Size(); i > 1; i--) { Pq.Pop(); } maxScore = Pq.Pop().Score; } return(new TopDocs(TotalHits, results, maxScore)); }
protected internal override int TopDocsSize() { return(CollectedHits < Pq.Size() ? CollectedHits : Pq.Size()); }