Source

gnocchi-blog / gnocchi / blog / search_indexes.py


from haystack.indexes import SearchIndex, CharField
from haystack import site
from gnocchi.blog import models

class PostIndex(SearchIndex):
    text = CharField(document=True, use_template=True)
    title = CharField(model_attr='title')

site.register(models.Post, PostIndex)

class CommentIndex(SearchIndex):
    text = CharField(document=True, use_template=True)

site.register(models.Comment, CommentIndex)