WhisperMaPhone/thoughts/search_indexes.py

13 lines
410 B
Python
Raw Permalink Normal View History

2021-10-21 14:00:25 +00:00
from haystack import indexes
from .models import Thought
class ThoughtIndex(indexes.SearchIndex, indexes.Indexable):
2022-05-03 17:31:01 +00:00
text = indexes.CharField(document=True, use_template=True, template_name="thoughts/search/thought_text.txt")
posted = indexes.DateTimeField(model_attr="posted")
2021-10-21 14:00:25 +00:00
def get_model(self):
return Thought
def index_queryset(self, using=None):
return Thought.objects