##// END OF EJS Templates
Fixed search indexes for tags
neko259 -
r914:000a8767 default
parent child Browse files
Show More
@@ -1,24 +1,24 b''
1 from haystack import indexes
1 from haystack import indexes
2 from boards.models import Post, Tag
2 from boards.models import Post, Tag
3
3
4 __author__ = 'neko259'
4 __author__ = 'neko259'
5
5
6
6
7 class PostIndex(indexes.SearchIndex, indexes.Indexable):
7 class PostIndex(indexes.SearchIndex, indexes.Indexable):
8 text = indexes.CharField(document=True, use_template=True)
8 text = indexes.CharField(document=True, use_template=True)
9
9
10 def get_model(self):
10 def get_model(self):
11 return Post
11 return Post
12
12
13 def index_queryset(self, using=None):
13 def index_queryset(self, using=None):
14 return self.get_model().objects.all()
14 return self.get_model().objects.all()
15
15
16
16
17 class TagIndex(indexes.SearchIndex, indexes.Indexable):
17 class TagIndex(indexes.SearchIndex, indexes.Indexable):
18 text = indexes.CharField(document=True, use_template=True)
18 text = indexes.CharField(document=True, use_template=True)
19
19
20 def get_model(self):
20 def get_model(self):
21 return Tag
21 return Tag
22
22
23 def index_queryset(self, using=None):
23 def index_queryset(self, using=None):
24 return self.get_model().objects.get_not_empty_tags()
24 return self.get_model().objects.all()
General Comments 0
You need to be logged in to leave comments. Login now