[ 
https://issues.apache.org/jira/browse/SOLR-18678?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18151562#comment-18151562
 ] 

Ivan Saric edited comment on SOLR-18678 at 11/26/26, 3:25 PM:
--------------------------------------------------------------

[~ab] +1 to typed children using the existing {{str}}/{{int}}/{{bool}}/… tags. 
One suggestion on the container: collect them into a {{SimpleOrderedMap}} (a 
{{Map}}) with unique names enforced at load time, rather than a {{NamedList}} 
that permits repeated names.
* {{SchemaField.getNamedPropertyValues}} and 
{{FieldType.getNamedPropertyValues}} already return {{SimpleOrderedMap}}, so 
metadata nested as a map renders as a JSON object in {{/schema/fields}} 
whatever {{json.nl}} is. A {{NamedList}} there renders as a flat array by 
default ({{["dc:description","…","dc:source","…"]}}), which Part 3 and the 
SolrJ side (Part 4) would have to special-case.
* Repeated names buy nothing here: multi-valued metadata can be {{<arr 
name="dc:subject"><str>…</str></arr>}}, which the existing parsing already 
turns into a {{List}}.
* It follows the 
[SIP-22|https://cwiki.apache.org/confluence/display/SOLR/SIP-22+Reduce+NamedList+Usage]
 direction: new code uses {{NamedList}} only where keys really repeat, and 
configuration roots get unique-key enforcement.

The change is small: reuse the tag/value parsing from 
{{ConfigNode.childNodesToNamedList}} but collect into a {{SimpleOrderedMap}} 
and fail with a clear error on a duplicate {{name}}. That also gives Part 2's 
validation rules a natural place to hook in.


was (Author: JIRAUSER311916):
[~ab] +1 to typed children using the existing {{str}}/{{int}}/{{bool}}/… tags. 
One suggestion on the container: collect them into a {{SimpleOrderedMap}} (a 
{{Map}}) with unique names enforced at load time, rather than a {{NamedList}} 
that permits repeated names.
* {{SchemaField.getNamedPropertyValues}} and 
{{FieldType.getNamedPropertyValues}} already return {{SimpleOrderedMap}}, so 
metadata nested as a map renders as a JSON object in {{/schema/fields}} 
whatever {{json.nl}} is. A {{NamedList}} there renders as a flat array by 
default ({{["dc:description","…","dc:source","…"]}}), which Part 3 and the 
SolrJ side (Part 4) would have to special-case.
* Repeated names buy nothing here: multi-valued metadata can be {{[arr 
name="dc:subject"][str]…[/str][/arr]}}, which the existing parsing already 
turns into a {{List}}.
* It follows the 
[SIP-22|https://cwiki.apache.org/confluence/display/SOLR/SIP-22+Reduce+NamedList+Usage]
 direction: new code uses {{NamedList}} only where keys really repeat, and 
configuration roots get unique-key enforcement.

The change is small: reuse the tag/value parsing from 
{{ConfigNode.childNodesToNamedList}} but collect into a {{SimpleOrderedMap}} 
and fail with a clear error on a duplicate {{name}}. That also gives Part 2's 
validation rules a natural place to hook in.

> Part 1: Add metadata to IndexSchema and SchemaField, and XML round-trip
> -----------------------------------------------------------------------
>
>                 Key: SOLR-18678
>                 URL: https://issues.apache.org/jira/browse/SOLR-18678
>             Project: Solr
>          Issue Type: Sub-task
>            Reporter: Andrzej Bialecki
>            Priority: Major
>
> Add schema metadata persisted in the schema XML as a child {{<metadata>}} 
> element with type-less {{<entry name="...">value</entry>}} children (or 
> perhaps typed str, int, bool, float, ...?).
> This format is rolling-upgrade safe, because older nodes ignore child 
> elements. Classic schema.xml parsing and managed-schema writing both support 
> it.
> Fields, dynamic fields and field types are included. There should be also a 
> top-level {{<metadata>}} element for the whole schema.
> Add necessary plumbing to IndexSchema and SchemaField classes.
> Schema metadata never affects indexing, queries or schema compatibility 
> checks, so a metadata-only change needs no reindex. Length caps on keys, 
> values and total size keep ZooKeeper nodes small. Tests will cover the XML 
> round-trip and a rolling-upgrade case where an older node loads the new 
> schema.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

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

Reply via email to