Lucene - Core
  1. Lucene - Core
  2. LUCENE-4798

PostingsHighlighter's formatter sometimes doesnt highlight matched terms

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 4.2, 6.0
    • Component/s: modules/highlighter
    • Labels:
      None
    • Lucene Fields:
      New

      Description

      This can happen if you have a sentence where the query terms match many times in the same sentence:

      for example if you query on "testing highlighter" but you have

      "Testing highlighters is sometimes harder than testing other things."

      The issue is that the formatter receives all 3 matches, but in this order:
      Testing (first occurrence)
      testing (second occurrence)
      highlighters

      The formatter expects the matches to be in sorted order by offset (not by term, then offset). This is how the javadocs say they should be.

      But there is currently a bug, a stupid side effect of how the ranking is done. Because of this, in this example "highlighters" isnt marked up in bold.

        Activity

        Hide
        Robert Muir added a comment -

        quick patch, just sorts by offset before handing to the formatter.

        I added the simple test case i found, but added an assert to the random test too which easily tripped on the bug.

        Show
        Robert Muir added a comment - quick patch, just sorts by offset before handing to the formatter. I added the simple test case i found, but added an assert to the random test too which easily tripped on the bug.
        Hide
        Uwe Schindler added a comment -

        The usage of SorterTemplate is correct. No bug in setPivot (it has to save the value not the index)!

        Show
        Uwe Schindler added a comment - The usage of SorterTemplate is correct. No bug in setPivot (it has to save the value not the index)!
        Hide
        Michael McCandless added a comment -

        +1, sneaky!

        Show
        Michael McCandless added a comment - +1, sneaky!
        Hide
        Commit Tag Bot added a comment -

        [trunk commit] Robert Muir
        http://svn.apache.org/viewvc?view=revision&revision=1450206

        LUCENE-4798: PostingsHighlighter's formatter sometimes doesnt highlight matched terms

        Show
        Commit Tag Bot added a comment - [trunk commit] Robert Muir http://svn.apache.org/viewvc?view=revision&revision=1450206 LUCENE-4798 : PostingsHighlighter's formatter sometimes doesnt highlight matched terms
        Hide
        Commit Tag Bot added a comment -

        [trunk commit] Robert Muir
        http://svn.apache.org/viewvc?view=revision&revision=1450220

        LUCENE-4798: remove accidentally inserted tabs

        Show
        Commit Tag Bot added a comment - [trunk commit] Robert Muir http://svn.apache.org/viewvc?view=revision&revision=1450220 LUCENE-4798 : remove accidentally inserted tabs
        Hide
        Commit Tag Bot added a comment -

        [trunk commit] Robert Muir
        http://svn.apache.org/viewvc?view=revision&revision=1450246

        LUCENE-4798: use java6 compatible method

        Show
        Commit Tag Bot added a comment - [trunk commit] Robert Muir http://svn.apache.org/viewvc?view=revision&revision=1450246 LUCENE-4798 : use java6 compatible method
        Hide
        Commit Tag Bot added a comment -

        [branch_4x commit] Robert Muir
        http://svn.apache.org/viewvc?view=revision&revision=1450248

        LUCENE-4798: use java6 compatible method

        Show
        Commit Tag Bot added a comment - [branch_4x commit] Robert Muir http://svn.apache.org/viewvc?view=revision&revision=1450248 LUCENE-4798 : use java6 compatible method
        Hide
        Commit Tag Bot added a comment -

        [branch_4x commit] Robert Muir
        http://svn.apache.org/viewvc?view=revision&revision=1450221

        LUCENE-4798: remove accidentally inserted tabs

        Show
        Commit Tag Bot added a comment - [branch_4x commit] Robert Muir http://svn.apache.org/viewvc?view=revision&revision=1450221 LUCENE-4798 : remove accidentally inserted tabs
        Hide
        Commit Tag Bot added a comment -

        [branch_4x commit] Robert Muir
        http://svn.apache.org/viewvc?view=revision&revision=1450208

        LUCENE-4798: PostingsHighlighter's formatter sometimes doesnt highlight matched terms

        Show
        Commit Tag Bot added a comment - [branch_4x commit] Robert Muir http://svn.apache.org/viewvc?view=revision&revision=1450208 LUCENE-4798 : PostingsHighlighter's formatter sometimes doesnt highlight matched terms
        Hide
        Uwe Schindler added a comment -

        Closed after release.

        Show
        Uwe Schindler added a comment - Closed after release.

          People

          • Assignee:
            Unassigned
            Reporter:
            Robert Muir
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development