Esempio n. 1
0
 // javadoc inherited
 public override void  Collect(int doc, float score)
 {
     if (score > 0.0f)
     {
         totalHits++;
         if (hq.Size() < numHits || score >= minScore)
         {
             hq.Insert(new ScoreDoc(doc, score));
             minScore = ((ScoreDoc)hq.Top()).score;  // maintain minScore
         }
     }
 }
Esempio n. 2
0
        /// <summary>The top-scoring hits. </summary>
        public virtual TopDocs TopDocs()
        {
            ScoreDoc[] scoreDocs = new ScoreDoc[hq.Size()];
            for (int i = hq.Size() - 1; i >= 0; i--)
            {
                // put docs in array
                scoreDocs[i] = (ScoreDoc)hq.Pop();
            }

            float maxScore = (totalHits == 0)?System.Single.NegativeInfinity:scoreDocs[0].score;

            return(new TopDocs(totalHits, scoreDocs, maxScore));
        }
Esempio n. 3
0
 /// <summary>Returns the top docs that were collected by this collector. </summary>
 public TopDocs TopDocs()
 {
     // In case pq was populated with sentinel values, there might be less
     // results than pq.size(). Therefore return all results until either
     // pq.size() or totalHits.
     return(TopDocs(0, totalHits < pq.Size()?totalHits:pq.Size()));
 }