<s> import datetime <EOL> import haystack . indexes as indexes <EOL> from aristotle_mdr . contrib . help import models <EOL> from django . template import TemplateDoesNotExist <EOL> from django . utils import timezone <EOL> from aristotle_mdr . search_indexes import RESTRICTION <EOL> class HelpObjectIndex ( indexes . SearchIndex ) : <EOL> text = indexes . CharField ( document = True , use_template = True ) <EOL> modified = indexes . DateTimeField ( model_attr = '<STR_LIT>' ) <EOL> created = indexes . DateTimeField ( model_attr = '<STR_LIT>' ) <EOL> name = indexes . CharField ( model_attr = '<STR_LIT:title>' ) <EOL> facet_model_ct = indexes . IntegerField ( faceted = True ) <EOL> is_public = indexes . BooleanField ( model_attr = '<STR_LIT>' ) <EOL> restriction = indexes . IntegerField ( faceted = True ) <EOL> def get_model ( self ) : <EOL> raise NotImplementedError <EOL> def index_queryset ( self , using = None ) : <EOL> """<STR_LIT>""" <EOL> return self . get_model ( ) . objects . filter ( modified__lte = timezone . now ( ) ) <EOL> def prepare_restriction ( self , obj ) : <EOL> return RESTRICTION [ '<STR_LIT>' ] <EOL> def prepare_facet_model_ct ( self , obj ) : <EOL> from django . contrib . contenttypes . models import ContentType <EOL> ct = ContentType . objects . get_for_model ( obj ) <EOL> return ct . pk <EOL> class ConceptHelpIndex ( HelpObjectIndex , indexes . Indexable ) : <EOL> template_name = "<STR_LIT>" <EOL> def get_model ( self ) : <EOL> return models . ConceptHelp <EOL> class HelpPageIndex ( HelpObjectIndex , indexes . Indexable ) : <EOL> template_name = "<STR_LIT>" <EOL> def get_model ( self ) : <EOL> return models . HelpPage </s>
