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

Yuki Yano commented on SOLR-11164:
----------------------------------

[~Jonathan GV]
Thank you for testing the patch! As you say, it will return the calculation of 
the 2nd phase query. However, in my understanding, this query is built from the 
parameter of "q" and thus it should be same as 1st phase query.

Details are as below. In short, both 1st phase request and 2nd phase request 
have same "q" parameter and it will be set to {{ResultContext}}.

1. {{OriginalScoreFeature}} uses {{rb.getQuery()}} for calculating the original 
score, which is given by {{RankQuery#wrap}}.
  
https://github.com/apache/lucene-solr/blob/releases/lucene-solr/6.6.0/solr/contrib/ltr/src/java/org/apache/solr/ltr/search/LTRQParserPlugin.java#L220
  
https://github.com/apache/lucene-solr/blob/releases/lucene-solr/6.6.0/solr/core/src/java/org/apache/solr/handler/component/ResponseBuilder.java#L427

2. As following codes, {{ResultContext}} is built from {{ResponseBuilder}} and 
it use {{rb.getQuery()}} as the query.
  
https://github.com/apache/lucene-solr/blob/releases/lucene-solr/6.6.0/solr/core/src/java/org/apache/solr/handler/component/QueryComponent.java#L367
  
https://github.com/apache/lucene-solr/blob/releases/lucene-solr/6.6.0/solr/core/src/java/org/apache/solr/response/BasicResultContext.java#L42

3. {{Query}} parsed from "q" is set the query of {{ResponseBuilder}} during 
preparing phase, which is executed in both 1st and 2nd phase.
  
https://github.com/apache/lucene-solr/blob/releases/lucene-solr/6.6.0/solr/core/src/java/org/apache/solr/handler/component/QueryComponent.java#L160-L167

4. In distributed process, {{QueryComponent}} sets original parameters when 
builds the 2nd phase request as following codes (i.e., same "q" parameter as 
1st phase).
  
https://github.com/apache/lucene-solr/blob/releases/lucene-solr/6.6.0/solr/core/src/java/org/apache/solr/handler/component/QueryComponent.java#L1287-L1288

> OriginalScoreFeature causes NullPointerException during feature logging with 
> SolrCloud mode.
> --------------------------------------------------------------------------------------------
>
>                 Key: SOLR-11164
>                 URL: https://issues.apache.org/jira/browse/SOLR-11164
>             Project: Solr
>          Issue Type: Bug
>      Security Level: Public(Default Security Level. Issues are Public) 
>          Components: contrib - LTR
>    Affects Versions: 6.6
>            Reporter: Yuki Yano
>         Attachments: SOLR-11164.patch
>
>
> In FeatureTransfer, OriginalScoreFeature uses original Query instance 
> preserved in LTRScoringQuery for the evaluation.
> This query is set in RankQuery#wrap during QueryComponent#process.
> With SolrCloud mode, document searches take two steps: finding top-N document 
> ids, and filling documents of found ids.
> In this case, FeatureTransformer works in the second step and tries to 
> extract features with LTRScoringQuery built in QueryComponent#prepare.
> However, because the second step doesn't call QueryComponent#process, the 
> original query of LTRScoringQuery remains null and this causes 
> NullPointerException while evaluating OriginalScoreFeature.
> We can get the original query from ResultContext which is an argument of 
> DocTransformer#setContext, thus this problem can solve by using it if 
> LTRScoringQuery doesn't have correct original query.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

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

Reply via email to