aboutsummaryrefslogtreecommitdiffstats
path: root/97suifangqa/apps/info/search_indexes.py
blob: 54916199fed64e7296b7b1815758a122a65c3673 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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())