I've got a number of different cores, each with its own schema, but they all share the same field types. I'd like to remove the duplication of the field type declarations and do something like this in my schema.xml files:
<?xml version="1.0" encoding="UTF-8" ?>
<schema name="foo" version="1.5">
<fields>
<field name="_version_" ...
<field name="id" ...
...
</fields>
<uniqueKey>id</uniqueKey>
<include "/path/to/field_types.xml">
</schema>
I don't see any mechanism in the docs to accomplish this however. I found one post referring to this:
<xi:include href="/path/to/field_types.xml" />
But that gives me a launch error: The prefix "xi" for element "xi:include" is not bound.
Anybody have an idea how to perform this type of raw include?
From this past Solr Issue - SOLR-3087, it looks like <xi:include>
is the correct syntax, you just need to include the xi namespace reference inline.
<?xml version="1.0" encoding="UTF-8" ?>
<schema name="foo" version="1.5">
<fields>
<field name="_version_" ...
<field name="id" ...
...
</fields>
<uniqueKey>id</uniqueKey>
<xi:include href="/path/to/field_types.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
</schema>
Another clean solution at this problem is add resources as external entities:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE schema
[
<!ENTITY schemafieldtypes SYSTEM "schemafieldtypes.xml">
]>
then, in the xml, you can add everywhere this:
&schemafieldtypes;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With