You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@solr.apache.org by "cpoerschke (via GitHub)" <gi...@apache.org> on 2023/02/22 16:15:21 UTC

[GitHub] [solr] cpoerschke commented on a diff in pull request #937: SOLR-16289: Null check in transformers of ltr module

cpoerschke commented on code in PR #937:
URL: https://github.com/apache/solr/pull/937#discussion_r1114576195


##########
solr/modules/ltr/src/java/org/apache/solr/ltr/response/transform/LTRFeatureLoggerTransformerFactory.java:
##########
@@ -362,9 +363,13 @@ private void implTransform(SolrDocument doc, int docid, Float score) throws IOEx
       LTRScoringQuery rerankingQuery = rerankingQueries[0];
       LTRScoringQuery.ModelWeight rerankingModelWeight = modelWeights[0];
       for (int i = 1; i < rerankingQueries.length; i++) {
-        if (((LTRInterleavingScoringQuery) rerankingQueriesFromContext[i])
-            .getPickedInterleavingDocIds()
-            .contains(docid)) {
+        Set<Integer> pickedInterleavingDocIds =
+            ((LTRInterleavingScoringQuery) rerankingQueriesFromContext[i])
+                .getPickedInterleavingDocIds();
+        if (pickedInterleavingDocIds == null) {
+          return;
+        }
+        if (pickedInterleavingDocIds.contains(docid)) {

Review Comment:
   I wonder if this could be combined here? Will add a commit to explore, feel free to revert.
   ```suggestion
           if (pickedInterleavingDocIds != null &&
               pickedInterleavingDocIds.contains(docid)) {
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org