WhisperMaPhone/thoughts/search_indexes.py

13 lines
410 B
Python

from haystack import indexes
from .models import Thought
class ThoughtIndex(indexes.SearchIndex, indexes.Indexable):
text = indexes.CharField(document=True, use_template=True, template_name="thoughts/search/thought_text.txt")
posted = indexes.DateTimeField(model_attr="posted")
def get_model(self):
return Thought
def index_queryset(self, using=None):
return Thought.objects