Skip to content

Commit

Permalink
LUCENE-8519: MultiDocValues.getNormValues should not call getMergedFi…
Browse files Browse the repository at this point in the history
…eldInfos (apache#902)


Co-authored-by: Rushabh Shah <[email protected]>
  • Loading branch information
2 people authored and dsmiley committed May 22, 2022
1 parent 59b6d41 commit d17c605
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lucene/CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ Improvements

Optimizations
---------------------
(No changes)
* LUCENE-8519: MultiDocValues.getNormValues should not call getMergedFieldInfos (Rushabh Shah)

Bug Fixes
---------------------
Expand Down
14 changes: 12 additions & 2 deletions lucene/core/src/java/org/apache/lucene/index/MultiDocValues.java
Original file line number Diff line number Diff line change
Expand Up @@ -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 == false) {
return null;
}

Expand Down

0 comments on commit d17c605

Please sign in to comment.