This issue is related to #5989.
Context and differentiation
#5989 is about changing the entire way of how schemas are handled and requires a lot of changes in Dataverse code, too. This is good and should be done.
This issue is about having a small workaround for easier deployment of custom metadata fields into the Solr schema, but still using the classic schema factory (in contrast to managed schema used by @pkiraly).
Idea
While getting gdcc/dataverse-kubernetes#85 ready for us (see also #6000), I thought about how to handle this. My basic idea:
- Remove this and this from
schema.xml
- Create a file
schema_dv_cmb_copies.xml and place all <copyField> from above in there.
- Create a file
schema_dv_cmb_fields.xml and place all <field> from above in there.
- Include these in
schema.xml:
<xi:include href="schema_dv_cmb_copies.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
<xi:include href="schema_dv_cmb_fields.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
(see also https://stackoverflow.com/questions/16968986)
This can be bundled in upstream and is transparent/usable for all type of installations, as long as the relevant files are moved around. Existing installations can continue to use their custom schemas. This approach is way easier than a template with necessary extra steps.
On changing the blocks or adding its own:
- the API generated fields can be replaced by a script, fetching from
<dvhost>/api/admin/index/solr/schema
- Replace the above files content
- Execute a RELOAD (see https://stackoverflow.com/questions/23782123)