cutting     2004/09/28 09:54:44

  Modified:    src/java/org/apache/lucene/search IndexSearcher.java
  Log:
  Oops.  Fixed a bug I introduced in my last change.  Thanks to
  Cristoph for catching this!  I overgeneralized.  Sorted results are
  not always the highest scoring.
  
  Revision  Changes    Path
  1.21      +3 -7      
jakarta-lucene/src/java/org/apache/lucene/search/IndexSearcher.java
  
  Index: IndexSearcher.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-lucene/src/java/org/apache/lucene/search/IndexSearcher.java,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- IndexSearcher.java        22 Sep 2004 17:03:00 -0000      1.20
  +++ IndexSearcher.java        28 Sep 2004 16:54:44 -0000      1.21
  @@ -123,15 +123,11 @@
         new FieldSortedHitQueue(reader, sort.fields, nDocs);
       final int[] totalHits = new int[1];
       scorer.score(new HitCollector() {
  -        private float minScore = 0.0f;
           public final void collect(int doc, float score) {
  -          if (score > 0.0f &&                     // ignore zeroed buckets
  -              (bits==null || bits.get(doc))) {    // skip docs not in bits
  +          if (score > 0.0f &&                          // ignore zeroed buckets
  +              (bits==null || bits.get(doc))) {         // skip docs not in bits
               totalHits[0]++;
  -            if (hq.size() < nDocs || score >= minScore) {
  -              hq.insert(new FieldDoc(doc, score));
  -              minScore = ((FieldDoc)hq.top()).score; // maintain minScore
  -            }
  +            hq.insert(new FieldDoc(doc, score));
             }
           }
         });
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to