mikemccand commented on code in PR #898:
URL: https://github.com/apache/lucene/pull/898#discussion_r875952557


##########
lucene/core/src/java/org/apache/lucene/index/MultiDocValues.java:
##########
@@ -53,8 +53,18 @@ public static NumericDocValues getNormValues(final 
IndexReader r, final String f
     } else if (size == 1) {
       return leaves.get(0).reader().getNormValues(field);
     }
-    FieldInfo fi = FieldInfos.getMergedFieldInfos(r).fieldInfo(field); // TODO 
avoid merging
-    if (fi == null || fi.hasNorms() == false) {
+
+    // Check if any of the leaf reader which has this field has norms.
+    boolean normFound = false;
+    for (LeafReaderContext leaf : leaves) {
+      LeafReader reader = leaf.reader();
+      FieldInfo info = reader.getFieldInfos().fieldInfo(field);
+      if (info != null && info.hasNorms()) {
+        normFound = true;
+        break;
+      }
+    }
+    if (!normFound) {

Review Comment:
   Maybe use `normFound == false` instead?  (For better readability and to 
reduce the risk of future refactoring bugs).



-- 
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-unsubscr...@lucene.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org

Reply via email to