Jump to >

This documentation covers the in-development release of Review Board. You can see the latest stable docs or all previous versions.


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.
declared_fields = {}[source]
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.

search_backend_id = None[source]

The search engine’s unique identifier.

name = None[source]

The human-readable name for the search engine.

haystack_backend_name = None[source]

The name of the Haystack search engine backend.

config_form_class = None[source]

The configuration form class for the search engine.

default_settings = {}[source]

The default search engine settings.

form_field_map = {}[source]

A mapping of search engine settings to form fields.


The configuration for the search engine.

Returns:The configuration for the search engine.
Return type:dict

Return the configuration from the form’s data.

form_data (dict):
The form data.
Returns:The search engine configuration.
Return type:dict

Return the form data for the current configuration.

Returns:The search engine form data.
Return type:dict

Validate any non-form prerequisites for using the backend.

Subclasses should attempt to import any required modules and, if they cannot be imported (i.e., an ImportError is raised), then a django.core.exceptions.ValidationError should be raised indicating the failure to load the module.

For example, the ElasticsearchSearchBackend requires the elasticsearch module to be available.

Raises:django.core.exceptions.ValidationError – Raised if a required module is missing.
get_config_form(data, **kwargs)[source]

Create and return a new configuration form instance.

The returned form will have a prefix of the search engine ID.

  • data (dict) – The form data.
  • **kwargs (dict) – Additional keyword arguments to pass to the form.

The instantiated form class.

Return type: