[jira] [Commented] (SOLR-8397) QueryScorer highlighting with join query causes classcast exception
[ https://issues.apache.org/jira/browse/SOLR-8397?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=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.(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 > =false > =somefield > ={!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: dev-unsubscr...@lucene.apache.org For additional commands, e-mail: dev-h...@lucene.apache.org
[jira] [Commented] (SOLR-8397) QueryScorer highlighting with join query causes classcast exception
[ https://issues.apache.org/jira/browse/SOLR-8397?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15049537#comment-15049537 ] Peter Ciuffetti commented on SOLR-8397: --- Good point! I wasn't expecting any highlights. This was an unfortunate side effect of our middleware always defaulting to having highlighting on unless turned off, and also having a backwards default of usePhraseHighlighter=false. This particular query didn't need any highlighting. But in our attempt to upgrade from 4.10 to 5.3 I'm dealing with legacy queries embedded in various unit tests and frontend code. So I have already worked around this by making the default usePhraseHighlighter=true. You can mark this bug minor or 'wont fix' if you'd like... just thought it should be reported. Maybe others will run into it if they use highlight queries maybe? Haven't tried this. > 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.(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 > =false > =somefield > ={!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: dev-unsubscr...@lucene.apache.org For additional commands, e-mail: dev-h...@lucene.apache.org