diff options
Diffstat (limited to '97suifangqa/apps/info/search_indexes.py')
-rw-r--r-- | 97suifangqa/apps/info/search_indexes.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/97suifangqa/apps/info/search_indexes.py b/97suifangqa/apps/info/search_indexes.py new file mode 100644 index 0000000..5491619 --- /dev/null +++ b/97suifangqa/apps/info/search_indexes.py @@ -0,0 +1,15 @@ +from haystack import indexes +import datetime +from .models import Query + + +class QueryIndex(indexes.SearchIndex, indexes.Indexable): + text = indexes.CharField(document=True, use_template=True) + + def get_model(self): + return Query + + def index_queryset(self, using=None): + """Used when the entire index for model is updated.""" + return self.get_model().objects.filter(created_at__lte=datetime.datetime.now()) + |