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")
|
2022-03-12 02:14:37 +00:00
|
|
|
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
|