You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ds...@apache.org on 2022/05/22 04:15:12 UTC
[lucene] branch main updated: LUCENE-8519: MultiDocValues.getNormValues should not call getMergedFieldInfos (#902)
This is an automated email from the ASF dual-hosted git repository.
dsmiley pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/lucene.git
The following commit(s) were added to refs/heads/main by this push:
new d17c6056d8c LUCENE-8519: MultiDocValues.getNormValues should not call getMergedFieldInfos (#902)
d17c6056d8c is described below
commit d17c6056d8caada6db6c1c4f280f54960e058ee2
Author: Rushabh Shah <sh...@gmail.com>
AuthorDate: Sat May 21 20:22:12 2022 -0700
LUCENE-8519: MultiDocValues.getNormValues should not call getMergedFieldInfos (#902)
Co-authored-by: Rushabh Shah <sh...@apache.org>
---
lucene/CHANGES.txt | 2 +-
.../src/java/org/apache/lucene/index/MultiDocValues.java | 14 ++++++++++++--
2 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txt
index 88ebf205167..4858e3082e7 100644
--- a/lucene/CHANGES.txt
+++ b/lucene/CHANGES.txt
@@ -79,7 +79,7 @@ Improvements
Optimizations
---------------------
-(No changes)
+* LUCENE-8519: MultiDocValues.getNormValues should not call getMergedFieldInfos (Rushabh Shah)
Bug Fixes
---------------------
diff --git a/lucene/core/src/java/org/apache/lucene/index/MultiDocValues.java b/lucene/core/src/java/org/apache/lucene/index/MultiDocValues.java
index b085dd775a9..145c0e34f3e 100644
--- a/lucene/core/src/java/org/apache/lucene/index/MultiDocValues.java
+++ b/lucene/core/src/java/org/apache/lucene/index/MultiDocValues.java
@@ -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;
}