Validate search configuration in the Search Settings page.
Review Request #11891 — Created Dec. 15, 2021 and submitted
The Search Settings page now validates the search configuration by
performing a test search. If it succeeds, the configuration is
considered valid. If it fails, a validation error is shown on the page.This requires some changes to how validation works. We had a
SearchBackend.validate()
method, which was originally built for
Elasticsearch so that it could check for the presence of a module. Now
it takes in the generated configuration, so it can build a Haystack
backend and perform the search.While it's unlikely there are any other custom search backends out
there, the new signature change tovalidate()
is not yet enforced. We
emit a deprecation warning if it lacks a**kwargs
argument.Subform validation is also now limited to the selected search engine, so
that one subform's errors won't result in other subforms showing errors
when selected.This will help prevent some confusion when configuration is broken,
particularly with the new multi-version Elasticsearch support.
Unit tests pass on Python 2 and 3.
Tested various good and bad configurations in Whoosh and Elasticsearch,
switching between the subforms to ensure only the active form attempted
validation.Tested searching and indexing on the working configurations.
- Change Summary:
-
Fixed a line length issue.
- Commits:
-
Summary ID 59b9ce264f2325730d5e11b0a6f8f937a30f7f2f fe09e929d9abfb58ef5d30106c18356e06a2450b - Diff:
-
Revision 2 (+424 -98)