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

Some subclasses of Scorer do not honor the contract of DocsEnum.freq()

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 4.5.1
    • None
    • core/query/scoring
    • None
    • New

    Description

      The behavior of Scorer.freq() is inconsistent across its subclasses:

      • For TermScorer, the freq() method behaves just as DocsEnum.freq() specifies, i.e. the method returns the "term frequency in the current document".
      • For BooleanScorer2, ConjunctionScorer, DisjunctionMaxScorer, DisjunctionSumScorer, and possibly other classes, the freq() method returns the number of clauses (in BooleanQuery or DisjunctionMaxQuery) that match the current document.

      This difference makes the meaning of Scorer.freq()'s return value uncertain. To add to the uncertainty, given a Query, there seems to be no way of knowing which behavior takes effect (as that is not specified in the API reference) except by reading or running the code.

      This issue might be related to LUCENE-4514.

      Attachments

        1. DisjunctionMaxQueryTest.java
          5 kB
          Kai Chan
        2. DisjunctionMaxQueryTest.java.output
          2 kB
          Kai Chan

        Activity

          People

            Unassigned Unassigned
            wkchan Kai Chan
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: