isaric commented on code in PR #5403:
URL: https://github.com/apache/solr/pull/5403#discussion_r4753633880


##########
solr/core/src/java/org/apache/solr/schema/FieldType.java:
##########
@@ -1343,6 +1355,9 @@ public SimpleOrderedMap<Object> 
getNamedPropertyValues(boolean showDefaults) {
             MULTI_TERM_ANALYZER, getAnalyzerProperties(((TextField) 
this).getMultiTermAnalyzer()));
       }
     }
+    if (!metadata.isEmpty()) {
+      namedPropertyValues.add(SchemaMetadata.META, metadata.toMap());

Review Comment:
   Non-blocking nit: a field type that keeps a `meta` string init arg (the 
`MetaArgField` case) *and* has a `<meta>` element ends up with two `meta` 
properties here, since the args are written above and this adds a second one. 
The XML writer copes (attribute plus element), but JSON output would carry a 
duplicate key. Rejecting the combination in `FieldTypePluginLoader`, or 
skipping the arg here when metadata is present, would avoid it. Contrived, so 
fine to defer.



##########
solr/core/src/java/org/apache/solr/util/DataConfigNode.java:
##########
@@ -135,11 +139,8 @@ public List<ConfigNode> getAll(Set<String> names, 
Predicate<ConfigNode> test) {
 
   @Override
   public void forEachChild(Function<ConfigNode, Boolean> fun) {
-    kids.forEach(
-        (s, configNodes) -> {
-          if (configNodes != null) {
-            configNodes.forEach(fun::apply);
-          }
-        });
+    // the callback's return value is ignored: ConfigNode.get(name) relies on 
child(name, null)
+    // returning the last matching element, e.g. an explicit section after an 
XInclude'd one
+    children.forEach(fun::apply);

Review Comment:
   Non-blocking. This fix reaches further than metadata: `DataConfigNode` wraps 
every cached `solrconfig.xml`, `solr.xml` and schema (`SolrConfig`, 
`SolrXmlConfig`, `IndexSchemaFactory`), so the init-args `NamedList` of every 
plugin loaded through the cache changes from tag-grouped order to document 
order, matching `DOMConfigNode`. It is the right behavior, but a plugin that 
read its args positionally would notice. Worth its own sentence in the 
changelog (or a second entry), so the change is findable from the release notes.



##########
solr/core/src/java/org/apache/solr/schema/SchemaField.java:
##########
@@ -472,7 +490,8 @@ public SimpleOrderedMap<Object> 
getNamedPropertyValues(boolean showDefaults) {
       for (Map.Entry<String, ?> arg : args.entrySet()) {
         String key = arg.getKey();
         Object value = arg.getValue();
-        if (key.equals(DEFAULT_VALUE)) {
+        if (!propertyMap.containsKey(key)) {
+          // not a boolean field property, e.g. default, postingsFormat, 
docValuesFormat

Review Comment:
   Non-blocking, just an observation. Good fix for 
`postingsFormat`/`docValuesFormat`. Note it is slightly broader than those two: 
any non-boolean arg now passes through unchanged. That is safe because 
`calcProps` already rejects unknown args at creation time, so only the known 
non-boolean ones can be present.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to