plateforme-corres2math/apps/participation/search_indexes.py

37 lines
890 B
Python
Raw Normal View History

2020-12-26 20:26:26 +00:00
# Copyright (C) 2020 by Animath
# SPDX-License-Identifier: GPL-3.0-or-later
from haystack import indexes
from .models import Participation, Team, Video
2020-10-15 14:29:50 +00:00
class TeamIndex(indexes.ModelSearchIndex, indexes.Indexable):
2020-10-30 18:46:46 +00:00
"""
Index all teams by their name and trigram.
"""
2020-10-15 15:26:22 +00:00
text = indexes.NgramField(document=True, use_template=True)
2020-10-15 14:29:50 +00:00
class Meta:
model = Team
2020-10-15 14:29:50 +00:00
class ParticipationIndex(indexes.ModelSearchIndex, indexes.Indexable):
2020-10-30 18:46:46 +00:00
"""
Index all participations by their team name and team trigram.
"""
2020-10-15 15:26:22 +00:00
text = indexes.NgramField(document=True, use_template=True)
2020-10-15 14:29:50 +00:00
class Meta:
model = Participation
2020-10-15 14:29:50 +00:00
class VideoIndex(indexes.ModelSearchIndex, indexes.Indexable):
2020-10-30 18:46:46 +00:00
"""
Index all teams by their team name and team trigram.
"""
2020-10-15 15:26:22 +00:00
text = indexes.NgramField(document=True, use_template=True)
2020-10-15 14:29:50 +00:00
class Meta:
model = Video