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

UnifiedHighlighter does not work with Surround query parser (SurroundQParser)

    XMLWordPrintableJSON

    Details

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

      Description

      I'm attempting to use the UnifiedHighlighter in conjunction with queries parsed by Solr's SurroundQParserPlugin. When doing so, the response yields empty arrays for documents that should contain highlighted snippets.

      I've attached a test for UnifiedHighlighter that uses the surround's QueryParser and preprocesses the query in a similar fashion as SurroundQParser, which results in test failure.  When creating a SpanQuery directly (rather via surround's QueryParser), the test passes.

      The problem can be isolated to the code path initiated by UnifiedHighlighter.extractTerms(), which uses EMPTY_INDEXSEARCHER to extract terms from the query. After a series of method calls, we end up at DistanceQuery.getSpanNearQuery(), where ((DistanceSubQuery)sqi.next()).addSpanQueries(sncf) fails silently and doesn't add any span queries.  

      Another data point: If I hack UnifiedHighlighter and pass in a live IndexSearcher to extractTerms(), highlighting works. 

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                dsmiley David Wayne Smiley
                Reporter:
                andyliu1227 Andy Liu
              • Votes:
                0 Vote for this issue
                Watchers:
                6 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: