Commit 76d18d9b authored by Gilles Quenot's avatar Gilles Quenot

add indexes fields

parent 30cb22ce
#TODO sputnick: c
from haystack import indexes
from representatives.models import Representative
class RepresentativeIndex(indexes.SearchIndex, indexes.Indexable):
text = indexes.EdgeNgramField(document=True, use_template=True)
slug = indexes.CharField(model_attr='slug', faceted=True)
......@@ -9,6 +9,9 @@ class RepresentativeIndex(indexes.SearchIndex, indexes.Indexable):
last_name = indexes.CharField(model_attr='last_name', faceted=True)
full_name = indexes.EdgeNgramField(model_attr='full_name')
ascii_name = indexes.NgramField(model_attr='ascii_name')
#new mappings (check src/representatives/models.py)
score = indexes.IntegerField(model_attr='representative_score') # simple field
mandates = MultiValueField() # iterable, check Okhin's UML (country, chamber, party...) => https://django-haystack.readthedocs.io/en/v2.4.1/searchindex_api.html?highlight=MultiValueField
def get_model(self):
return Representative
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment