Jump to >

reviewboard.search.indexes

class BaseSearchIndex[source]

Bases: haystack.indexes.SearchIndex

Base class for a search index.

This sets up a few common fields we want all indexes to include.

model = None[source]

The model to index.

local_site_attr = None[source]

The local site attribute on the model.

For ForeignKeys, this should be the name of the ID field, as in ‘local_site_id’. For ManyToManyFields, it should be the standar field name.

text = <haystack.fields.CharField object>[source]
local_sites = <haystack.fields.MultiValueField object>[source]
NO_LOCAL_SITE_ID = 0[source]
get_model()[source]

Return the model for this index.

prepare_local_sites(obj)[source]

Prepare the list of local sites for the search index.

This will take any associated local sites on the object and store them in the index as a list. The search view can then easily look up values in the list, regardless of the type of object.

If the object is not a part of a local site, the list will be [0], indicating no local site.

fields = {'local_sites': <haystack.fields.MultiValueField object at 0x10b7e5d50>, 'text': <haystack.fields.CharField object at 0x10b7e5d10>}[source]
objects = <haystack.manager.SearchIndexManager object>[source]