Reputation: 6494
Is it possible to store a custom version number somewhere in the Solr schema so that it could be retrieved by the client in order to verify that it is connected to a compatible Solr instance?
When I'm deploying a new version of the application to QA or production I need to be sure that all the data sources (Solr, RDBMS, etc) my app is connected to have been properly updated/migrated. So I want to perform some validation at the startup. It's easy with the database (e.g. storing current schema version in the VERSION table), but it's less obvious where to store the version information for the Solr schema.
Upvotes: 1
Views: 1056
Reputation: 22555
The SystemInfoHandler will provide the version along with other information about the Solr instance. In later versions of Solr (3.x & 4.x), this is already enabled as part of the admin requestHandler.
You can access the information via http://localhost:8983/solr/admin/system
from the example site distributed with Solr. Modify the url accordingly for your Solr configuration.
Note: If you are running an older version of Solr this can be enabled by adding the following line to the solrconfig.xml file.
<requestHandler name="/admin/system" class="solr.admin.SystemInfoHandler" />
Update: For the specific scenario of knowing when the schema has changed (e.g. version the schema) can be accomplished by updating the name attribute of root node every time the schema file is modified. This name value will then be available in the SystemInfoHandler response.
Upvotes: 2