You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Michael Joyner <mi...@newsrx.com> on 2018/09/24 15:28:21 UTC

Is there an easy way to compare schemas?

Is there an easy way to compare schemas?

When upgrading nodes, we are wanting to compare the "core" and 
"automatically mapped" data types between our existing schema and the 
new manage-schema available as part of the upgraded distrubtion.

Re: Is there an easy way to compare schemas?

Posted by Alexandre Rafalovitch <ar...@gmail.com>.
I think the easiest would be to create two instances using those
schemas and then see what comes back from schema API:
http://lucene.apache.org/solr/guide/7_4/schema-api.html#retrieve-schema-information

That will give you the outputs in the consistent format, you can just
run diff on.

However, if you want to actually do a graph analysis on
explicit+dynamic fields -> definitions, then it is a bit more work.
Doable, but is a mini-project. I did something similar before, but the
code is not open-source at this moment. And it really depends on what
_very specific_ question you are trying to answer. For example, it is
not clear whether any example schema dynamic field should be part of
the "used" calculation just because it exists...

Regards,
   Alex.

On 24 September 2018 at 11:28, Michael Joyner <mi...@newsrx.com> wrote:
> Is there an easy way to compare schemas?
>
> When upgrading nodes, we are wanting to compare the "core" and
> "automatically mapped" data types between our existing schema and the new
> manage-schema available as part of the upgraded distrubtion.

Re: Is there an easy way to compare schemas?

Posted by Shawn Heisey <ap...@elyograg.org>.
On 9/24/2018 9:28 AM, Michael Joyner wrote:
> Is there an easy way to compare schemas?
>
> When upgrading nodes, we are wanting to compare the "core" and 
> "automatically mapped" data types between our existing schema and the 
> new manage-schema available as part of the upgraded distrubtion.

There is no difference in the format between schema.xml with the Classic 
schema factory and managed-schema with the new factory. The difference 
is that managed-schema can be changed by Solr, and schema.xml could only 
be changed externally to Solr.

And for the most part, the format for new versions is the same as the 
format for old versions.  At some point the <fields> and <types> tags 
became optional - they are no longer required.

Because the basic format hasn't changed, if the two files are mostly 
similar, you can simply diff the schema.xml in your older version with 
the managed-schema in the newer version.  It might be a good idea to use 
the option for diff that ignores differences in whitespace.  If the 
files are substantially different in how they are laid out, then you 
might need to manually compare them.

Thanks,
Shawn