LUCENE-8519: MultiDocValues.getNormValues should not call getMergedFieldInfos (#902)

Co-authored-by: Rushabh Shah <shahrs87@apache.org>
This commit is contained in:
Rushabh Shah 2022-05-21 20:22:12 -07:00 committed by David Smiley
parent 59b6d41bd1
commit d17c6056d8
2 changed files with 13 additions and 3 deletions

View File

@ -79,7 +79,7 @@ Improvements
Optimizations
---------------------
(No changes)
* LUCENE-8519: MultiDocValues.getNormValues should not call getMergedFieldInfos (Rushabh Shah)
Bug Fixes
---------------------

View File

@ -53,8 +53,18 @@ public class MultiDocValues {
} 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 == false) {
return null;
}