You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Andy Liu (JIRA)" <ji...@apache.org> on 2018/04/23 19:15:00 UTC

[jira] [Comment Edited] (SOLR-12242) UnifiedHighlighter does not work with Surround query parser (SurroundQParser)

    [ https://issues.apache.org/jira/browse/SOLR-12242?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16448731#comment-16448731 ] 

Andy Liu edited comment on SOLR-12242 at 4/23/18 7:14 PM:
----------------------------------------------------------

Yeah, I noticed that.  I did it in an super hacky way – in highlightFieldsAsObjects() I noticed that the output of UnifiedHighlighter.extractTerms() is passed into getFieldHighlighter(), which is an instance method.  So I subclassed UnifiedHighlighter and with an overridden implementation of  getFieldHighlighter() which does the term extraction with the live searcher, and passes the result to  super.getFieldHighlighter() .

Super brittle but works for now.


was (Author: andyliu1227):
Yeah, I noticed that.  I did it in an super hacky way – in highlightFieldsAsObjects() I noticed that the output of UnifiedHighlighter.extractTerms() is passed into getFieldHighlighter(), which is an instance method.  So I subclassed UnifiedHighlighter and with an overridden implementation of  getFieldHighlighter() which does the term extraction with the live searcher.

Super brittle but works for now.

> UnifiedHighlighter does not work with Surround query parser (SurroundQParser)
> -----------------------------------------------------------------------------
>
>                 Key: SOLR-12242
>                 URL: https://issues.apache.org/jira/browse/SOLR-12242
>             Project: Solr
>          Issue Type: Bug
>      Security Level: Public(Default Security Level. Issues are Public) 
>          Components: highlighter
>    Affects Versions: 7.2.1
>            Reporter: Andy Liu
>            Priority: Major
>         Attachments: TestUnifiedHighlighterSurround.java
>
>
> 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. 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org