You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucene.apache.org by GitBox <gi...@apache.org> on 2022/04/28 11:49:21 UTC

[GitHub] [lucene] jpountz commented on a diff in pull request #842: LUCENE-10518: Relax field consistency check for old indices

jpountz commented on code in PR #842:
URL: https://github.com/apache/lucene/pull/842#discussion_r860789641


##########
lucene/core/src/java/org/apache/lucene/index/FieldInfos.java:
##########
@@ -350,6 +360,11 @@ static final class FieldNumbers {
       this.omitNorms = new HashMap<>();
       this.storeTermVectors = new HashMap<>();
       this.softDeletesFieldName = softDeletesFieldName;
+      this.strictlyConsistent = indexCreatedVersionMajor >= 9;
+    }
+
+    FieldNumbers(String softDeletesFieldName) {

Review Comment:
   does this ctor have many call sites, could we always use the 2-args ctor?



##########
lucene/CHANGES.txt:
##########
@@ -94,8 +94,10 @@ Bug Fixes
   no documents instead of throwing an NPE. (Greg Miller)
 
 * LUCENE-10470: Check if polygon has been successfully tessellated before we fail (we are failing some valid
-  tessellations) and allow filtering edges that fold on top of the previous one. (Ignacio Vera)  
-  
+  tessellations) and allow filtering edges that fold on top of the previous one. (Ignacio Vera)
+

Review Comment:
   remove the space on this empty line?



##########
lucene/core/src/java/org/apache/lucene/index/FieldInfos.java:
##########
@@ -178,7 +179,15 @@ public static FieldInfos getMergedFieldInfos(IndexReader reader) {
               .filter(Objects::nonNull)
               .findAny()
               .orElse(null);
-      final Builder builder = new Builder(new FieldNumbers(softDeletesField));
+      final int indexCreatedVersionMajor =
+          leaves.stream()
+              .map(l -> l.reader().getMetaData())
+              .filter(Objects::nonNull)
+              .mapToInt(r -> r.getCreatedVersionMajor())
+              .min()
+              .orElse(Version.LATEST.major);

Review Comment:
   I'd like it a bit better if we moved to a for-each loop and threw an error if two segments happen to have different versions, since we'd be in trouble in that case?



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

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


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