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

Highlighting boolean queries shouldn't always highlight some clauses

    Details

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

      Description

      I am having difficulties with getting correct "highlighting" section from Solr.

      My query returns correct results, only highlighting does not work as I would expected.

      My query:

      http://solrServer/solr/solrCore/select?q=(((field1:((word1)AND(word2)))%20OR%20(field2:((word1)AND(word2)))%20OR%20(field3:((word1)AND(word2)))%20OR%20(field4:((word1)AND(word2)))))&fq=field5:(xxxx)&hl=true&hl.q=field1:(word1)&hl.fl=field1,field2,field3,field4

      If I run this query the highlighting section is correct - there is no document with phrase "word1" - therefore field1 is not listed in the highlighting element - correct.

      If I update my query to:

      http://solrServer/solr/solrCore/select?q=(((field1:((word1)AND(word2)))%20OR%20(field2:((word1)AND(word2)))%20OR%20(field3:((word1)AND(word2)))%20OR%20(field4:((word1)AND(word2)))))&fq=field5:(xxxx)&hl=true&hl.q=field1:(word1 OR word2)&hl.fl=field1,field2,field3,field4

      then I am not getting expected results, word2 has been found in field1 but word1 is missing, but Solr returned field1 in highlighting element with highlighted "word2" only.

      I have explicitly added an extra query using hl.q and I have used AND operator (word1 AND word2), why Solr returns field1 in case when only word2 has been found?

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                damianpawski Damian Pawski
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: