Validate search configuration in the Search Settings page.

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

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.

Summary ID
Validate search configuration in the Search Settings page.
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. This will help prevent some confusion when configuration is broken, particularly with the new multi-version Elasticsearch support.
fe09e929d9abfb58ef5d30106c18356e06a2450b
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 ID
Validate search configuration in the Search Settings page.
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. This will help prevent some confusion when configuration is broken, particularly with the new multi-version Elasticsearch support.
59b9ce264f2325730d5e11b0a6f8f937a30f7f2f
Validate search configuration in the Search Settings page.
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. This will help prevent some confusion when configuration is broken, particularly with the new multi-version Elasticsearch support.
fe09e929d9abfb58ef5d30106c18356e06a2450b

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...