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

BoostingTermQuery.explain() bugs

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 2.2
    • None
    • core/search
    • None
    • Patch Available

    Description

      There are a couple of minor bugs in BoostingTermQuery.explain().

      1. The computation of average payload score produces NaN if no payloads were found. It should probably be:
      float avgPayloadScore = super.score() * (payloadsSeen > 0 ? (payloadScore / payloadsSeen) : 1);

      2. If the average payload score is zero, the value of the explanation is 0:
      result.setValue(nonPayloadExpl.getValue() * avgPayloadScore);
      If the query is part of a BooleanClause, this results in:
      "no match on required clause..."
      "failure to meet condition(s) of required/prohibited clause(s)"

      The average payload score can be zero if the field boost = 0.

      I've attached a patch to 'TestBoostingTermQuery.java', however, the test 'testNoPayload' fails in 'SpanScorer.score()' because the doc = -1. It looks like 'setFreqCurrentDoc() should have been called before 'score()'. Maybe someone more knowledgable of spans could investigate this.

      Attachments

        1. TestBoostingTermQuery.patch
          2 kB
          Peter Keegan
        2. TestBoostingTermQuery2.patch
          5 kB
          Grant Ingersoll
        3. TestBoostingTermQuery3.patch
          5 kB
          Grant Ingersoll
        4. TestBoostingTermQuery4.patch
          5 kB
          Grant Ingersoll

        Activity

          People

            gsingers Grant Ingersoll
            pkeegan Peter Keegan
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: