diff --git a/apps/participation/search_indexes.py b/apps/participation/search_indexes.py index 2a6f88a..2fb17e8 100644 --- a/apps/participation/search_indexes.py +++ b/apps/participation/search_indexes.py @@ -3,16 +3,17 @@ from haystack import indexes from .models import Participation, Team, Video -class TeamIndex(indexes.SearchIndex, indexes.Indexable): - text = indexes.EdgeNgramField(document=True, model_attr="name") - trigram = indexes.EdgeNgramField(model_attr="trigram") - - def get_model(self): - return Team +class TeamIndex(indexes.ModelSearchIndex, indexes.Indexable): + class Meta: + model = Team -class ParticipationIndex(indexes.SearchIndex, indexes.Indexable): - text = indexes.EdgeNgramField(document=True, model_attr="team__name") +class ParticipationIndex(indexes.ModelSearchIndex, indexes.Indexable): + class Meta: + model = Participation + + +class VideoIndex(indexes.ModelSearchIndex, indexes.Indexable): + class Meta: + model = Video - def get_model(self): - return Participation diff --git a/apps/registration/search_indexes.py b/apps/registration/search_indexes.py index 07614ed..60f5ade 100644 --- a/apps/registration/search_indexes.py +++ b/apps/registration/search_indexes.py @@ -3,11 +3,6 @@ from haystack import indexes from .models import Registration -class RegistrationIndex(indexes.SearchIndex, indexes.Indexable): - text = indexes.EdgeNgramField(document=True, model_attr="user__username") - last_name = indexes.EdgeNgramField(model_attr="user__last_name") - first_name = indexes.EdgeNgramField(model_attr="user__first_name") - email = indexes.EdgeNgramField(model_attr="user__email") - - def get_model(self): - return Registration +class RegistrationIndex(indexes.ModelSearchIndex, indexes.Indexable): + class Meta: + model = Registration