Uploaded image for project: 'Lucene - Core'
  1. Lucene - Core
  2. LUCENE-462

bad normalization in sorted search returning TopDocs

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.9
    • Component/s: None
    • Labels:
      None

      Description

      FieldSortedHitQueue.maxscore is maintained in the lessThan method (which never gets called if a single document is added to the queue).

      I've checked in a test to TestSort.testTopDocsScores() with the final assertion commented out.

        Activity

        Hide
        yseeley@gmail.com Yonik Seeley added a comment -

        Proposed patch attached:

        • insert(FieldDoc) keeps track of maxscore and calls super.insert(Object)
        • the maximum score is now kept track of, even if it is less than 1.0
        • getMaxScore() added

        This should also be slightly faster than the old way since there are only "n" comparisons against maxscore.
        Previously, two comparisons would be done for every call to lessThan() (2*nlog maybe?)

        Show
        yseeley@gmail.com Yonik Seeley added a comment - Proposed patch attached: insert(FieldDoc) keeps track of maxscore and calls super.insert(Object) the maximum score is now kept track of, even if it is less than 1.0 getMaxScore() added This should also be slightly faster than the old way since there are only "n" comparisons against maxscore. Previously, two comparisons would be done for every call to lessThan() (2*nlog maybe?)
        Hide
        yseeley@gmail.com Yonik Seeley added a comment -

        fixed.

        Show
        yseeley@gmail.com Yonik Seeley added a comment - fixed.

          People

          • Assignee:
            yseeley@gmail.com Yonik Seeley
            Reporter:
            yseeley@gmail.com Yonik Seeley
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development