This week we were once again visited by the Edismax field alias bug in Solr: Searches with boosts, such as
foo^2.5, stopped working. The problem arises when an alias with one or more non-existing fields is defined in solrconfig.xml and it is tedious to track down as one needs to check for existence of all the fields referenced.
We have a 10+ different Solr setups and we use aliases in most of them. So a quick script was whipped together: validate_config.sh, which (…wait for it…) validates Solr configs. Nothing fancy and it tends to report false positives when things are commented out in the XML files. Still, it does check that
- all fields in schema.xml references existing field types
- all copyFields in schema.xml references existing fields
- all fields referenced in solrconfig.xml are defined in schema.xml
- no alias in solrconfig.sh has the same name as a field in schema.xml
Some of these problems, such as referencing a non-existing fields in
pf in solrconfig.xml, are silent and hard to track down: Solr does not complain and searches seem to work. But in the case of misspellings of field names, the result is poorer quality searches as the intended functionality is not activated.
Cross-validation of fields used in solrconfig.xml and schema.xml would be nice to have as part of Solr core startup, but until then the validate_config.sh script might be of use. Get it at GitHub.