Validate search configuration in the Search Settings page.

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

chipx86
Review Board
release-4.0.x
reviewboard

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.

Summary
Validate search configuration in the Search Settings page.
Description From Last Updated

E501 line too long (80 > 79 characters)

reviewbotreviewbot

F401 'django.utils.six' imported but unused

reviewbotreviewbot
Checks run (1 failed, 1 succeeded)
flake8 failed.
JSHint passed.

flake8

chipx86
Review request changed

Change Summary:

Fixed a line length issue.

Commits:

Summary
-
Validate search configuration in the Search Settings page.
+
Validate search configuration in the Search Settings page.

Diff:

Revision 2 (+424 -98)

Show changes

Checks run (1 failed, 1 succeeded)

flake8 failed.
JSHint passed.

flake8

david
  1. Ship It!
  2. 
      
chipx86
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to release-4.0.x (a99abfb)
Loading...