reviewboard.search.search_backends.base¶
The base search backend classes.
- 
class SearchBackendForm(*args, **kwargs)[source]¶
- Bases: - django.forms.forms.Form- A search backend configuration form. - This form allows the configuration of a Haystack backend to be configured from the admin interface and reloaded on the fly. - 
__init__(*args, **kwargs)[source]¶
- Initialize the backend. - Parameters: - request (django.http.HttpRequest) – The current HTTP request. 
 
- 
- 
class SearchBackend[source]¶
- Bases: - object- A search backend. - A SearchBackend is a wrapper around a Haystack backend that has methods for getting and setting per-backend configuration. This allows the backend to be configured at runtime and live reloaded, instead of having them hardcoded in - settings.py.- 
configuration[source]¶
- The configuration for the search engine. - Returns: - The configuration for the search engine. - Return type: - dict 
 - 
get_configuration_from_form_data(form_data)[source]¶
- Return the configuration from the form’s data. - Args:
- form_data (dict):
- The form data.
 
 - Returns: - The search engine configuration. - Return type: - dict 
 - 
get_form_data()[source]¶
- Return the form data for the current configuration. - Returns: - The search engine form data. - Return type: - dict 
 - 
load_haystack_engine(**kwargs)[source]¶
- Load the Haystack backend engine. - This will construct the engine with the provided parameters. A new instance will be constructed every time this is called. - Parameters: - **kwargs (dict) – Keyword arguments to pass to the engine constructor. - Returns: - The resulting engine instance. - Return type: - django_haystack.backends.BaseEngine 
 - 
validate(configuration, **kwargs)[source]¶
- Validate the settings and dependencies for the search backend. - This will perform a test search to ensure the configuration works. - Subclasses can override this to perform other checks that may be required (such as checking for a suitable module). They should call the parent method in order to perform a test search using the configured settings. - Changed in version 4.0.5: Added the - configurationand- **kwargsarguments. Subclasses msut be updated to take- **kwargs.- Raises: - django.core.exceptions.ValidationError– Backend configuration, supporting modules, or the test search failed.
 
- 
