it/itf/bestpractices/search_indexes.py
2011-10-08 06:09:33 +05:30

25 lines
829 B
Python

from haystack.indexes import *
from haystack import site
from models import *
class BestPracticeIndex(SearchIndex):
text = CharField(document=True, use_template=True)
title = CharField(model_attr='title')
story = CharField(model_attr='story')
guideline = CharField(model_attr='guideline')
law = CharField(model_attr='law')
theatre = CharField(model_attr='theatre')
quick_howto = CharField(model_attr='quick_howto')
# pub_date = DateTimeField(model_attr='pub_date')
category = CharField(model_attr='category')
# added = DateTimeField(model_attr='added')
'''
def index_queryset(self):
"""Used when the entire index for model is updated."""
return Note.objects.filter(pub_date__lte=datetime.datetime.now())
'''
site.register(BestPractice, BestPracticeIndex)