plateforme-tfjm2/participation/search_indexes.py

37 lines
889 B
Python
Raw Permalink Normal View History

2020-12-27 10:49:54 +00:00
# Copyright (C) 2020 by Animath
# SPDX-License-Identifier: GPL-3.0-or-later
from haystack import indexes
2021-01-18 22:49:27 +00:00
from .models import Participation, Team, Tournament
2020-12-27 10:49:54 +00:00
class TeamIndex(indexes.ModelSearchIndex, indexes.Indexable):
"""
Index all teams by their name and trigram.
"""
text = indexes.NgramField(document=True, use_template=True)
class Meta:
model = Team
class ParticipationIndex(indexes.ModelSearchIndex, indexes.Indexable):
"""
Index all participations by their team name and team trigram.
"""
text = indexes.NgramField(document=True, use_template=True)
class Meta:
model = Participation
2021-01-18 22:49:27 +00:00
class TournamentIndex(indexes.ModelSearchIndex, indexes.Indexable):
"""
Index all tournaments by their name.
"""
text = indexes.NgramField(document=True, use_template=True)
class Meta:
model = Tournament