Validate search configuration in the Search Settings page.

Review Request #11891 — Created Dec. 15, 2021 and submitted — Latest diff uploaded

Information

Review Board
release-4.0.x

Reviewers

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 to validate() 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.

Commits

Files

    Loading...