简体   繁体   中英

Is it possible to create a base Solr schema?

We have a number of Solr schema.xml files that are all nearly identical. It would be great if we could pull out the common parts and put them in a base schema that we then override in custom schema files.

Looking at my schema files, about 1/7th of each file is custom and the rest is boilerplate that could be pulled out and centralized.

Is there a way to do this?

If you're looking to do this is solr itself then I don't think that's possible.

Alternatively what you could do is have one copy of your base schema that you use every time you create a new core/collection and then use the schema api to make whatever changes you need. This will however require you to write some code or make some api calls at the least.

TYPO3 does it using general XML x:include . Here is the English example on GitHub, and they have a lot more there.

This probably will not play well with the managed schema, as it will regenerate a full-schema on first read.

Alternatively, as Binoy wrote, bootstrap schema from common source and then use Schema API to apply the changes.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM