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

David Smiley commented on SOLR-8397:
------------------------------------

Pete, aside from the unexpected unfortunate exception, what behavior were you 
expecting when highlighting a join query?

The standard Highlighter's SpanScorer effectively ignores queries it doesn't 
know about, and that which don't subclass MultiTermQuery.
The standard Highlighter's QueryScorer gets the query weight to then call 
extractTerms, and it does so using an empty IndexReader.  The 
PostingsHighlighter does the same.

I think what should probably be done is modify JoinQuery in JoinQParserPlugin 
to have a createWeight() that will return a no-op / non-scoring, no-doc Weight 
(e.g. new BooleanQuery.Builder().build().createWeight) in the event the 
IndexSearcher isn't a SolrIndexSearcher and it has 0 docs.  I don't think the 
highlighters are doing anything wrong here.  This is definitely an edge case.

> QueryScorer highlighting with join query causes classcast exception
> -------------------------------------------------------------------
>
>                 Key: SOLR-8397
>                 URL: https://issues.apache.org/jira/browse/SOLR-8397
>             Project: Solr
>          Issue Type: Bug
>          Components: highlighter
>    Affects Versions: 5.3
>         Environment: SolrCloud 5.3.1
>            Reporter: Peter Ciuffetti
>
> If you use the combination of a join query with the 'old' QueryScorer as a 
> highlighter, you get a classcast exception
> {code}
> java.lang.ClassCastException: org.apache.lucene.search.IndexSearcher cannot 
> be cast to org.apache.solr.search.SolrIndexSearcher
>       at 
> org.apache.solr.search.JoinQuery.createWeight(JoinQParserPlugin.java:217)
>       at 
> org.apache.lucene.search.IndexSearcher.createWeight(IndexSearcher.java:855)
>       at 
> org.apache.lucene.search.IndexSearcher.createNormalizedWeight(IndexSearcher.java:838)
>       at 
> org.apache.lucene.search.highlight.QueryTermExtractor.getTerms(QueryTermExtractor.java:131)
>       at 
> org.apache.lucene.search.highlight.QueryTermExtractor.getTerms(QueryTermExtractor.java:106)
>       at 
> org.apache.lucene.search.highlight.QueryTermExtractor.getTerms(QueryTermExtractor.java:119)
>       at 
> org.apache.lucene.search.highlight.QueryTermExtractor.getTerms(QueryTermExtractor.java:62)
>       at 
> org.apache.lucene.search.highlight.QueryTermScorer.<init>(QueryTermScorer.java:52)
>       at 
> org.apache.solr.highlight.DefaultSolrHighlighter.getQueryScorer(DefaultSolrHighlighter.java:244)
>       at 
> org.apache.solr.highlight.DefaultSolrHighlighter.getHighlighter(DefaultSolrHighlighter.java:197)
>       at 
> org.apache.solr.highlight.DefaultSolrHighlighter.doHighlightingByHighlighter(DefaultSolrHighlighter.java:586)
>       at 
> org.apache.solr.highlight.DefaultSolrHighlighter.doHighlighting(DefaultSolrHighlighter.java:428)
>       at 
> org.apache.solr.handler.component.HighlightComponent.process(HighlightComponent.java:143)
>       at 
> org.apache.solr.handler.component.SearchHandler.handleRequestBody(SearchHandler.java:277)
>       at 
> org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:143)
> {code}
> the query parameters that will produce this are
> {code}
> ?hl=true
> &hl.usePhraseHighlighter=false
> &hl.fl=somefield
> &q={!join from=x to=y}somequery
> {code}
> This does not happen when the default SpanScorer is used (which happens when 
> hl.usePhraseHighlighter=true or is unspecified)



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to