john-wagster commented on code in PR #17018:
URL: https://github.com/apache/lucene/pull/17018#discussion_r4568904532


##########
lucene/queries/src/java/org/apache/lucene/queries/spans/SpanWeight.java:
##########
@@ -111,14 +111,40 @@ private Similarity.SimScorer buildSimWeight(
             searcher.termStats(entry.getKey(), ts.docFreq(), 
ts.totalTermFreq());
       }
     }
-    FieldStats fieldStats = searcher.fieldStats(query.getField());
     if (termUpTo > 0) {
-      return similarity.scorer(boost, fieldStats, 
ArrayUtil.copyOfSubArray(termStats, 0, termUpTo));
+      termStats = ArrayUtil.copyOfSubArray(termStats, 0, termUpTo);
+      FieldStats fieldStats = searcher.fieldStats(query.getField());
+      if (fieldStats == null) {
+        // the query field and term fields can be different (see 
FieldMaskingSpanQuery);

Review Comment:
   this comment largely says the same thing as the javadoc.  Maybe consider 
removing it? 



##########
lucene/CHANGES.txt:
##########
@@ -463,6 +465,7 @@ Build
 
 * GITHUB#14804: Detect and ban wildcard imports in Java (Robert Muir, Dawid 
Weiss)
 
+

Review Comment:
   nit: extra line



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to