dnhatn commented on code in PR #12326:
URL: https://github.com/apache/lucene/pull/12326#discussion_r1213908644


##########
lucene/core/src/java/org/apache/lucene/index/FieldInfos.java:
##########
@@ -708,6 +750,23 @@ FieldInfo add(FieldInfo fi, long dvGen) {
       final FieldInfo curFi = fieldInfo(fi.getName());
       if (curFi != null) {
         curFi.verifySameSchema(fi, globalFieldNumbers.strictlyConsistent);
+
+        if (!globalFieldNumbers.strictlyConsistent) {
+          // For the not strictly consistent case (legacy index), we may need 
to merge the
+          // FieldInfo instances
+          FieldInfo updatedFieldInfo = curFi.handleLegacySupportedUpdates(fi);
+          if (updatedFieldInfo != null) {
+            if (fi.getDocValuesType() != DocValuesType.NONE
+                && curFi.getDocValuesType() == fi.getDocValuesType()) {
+              // Must also update docValuesType map so it's
+              // aware of this field's DocValuesType.  This will throw 
IllegalArgumentException if
+              // an illegal type change was attempted.
+              globalFieldNumbers.setDocValuesType(fi.number, fi.getName(), 
fi.getDocValuesType());

Review Comment:
   I think we should only call this when the doc_values type changed from None 
to something else?



-- 
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