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())
    '''

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


site.register(BestPractice, BestPracticeIndex)
site.register(Guideline, GuidelineIndex)
