add search indexes for all apps

This commit is contained in:
Sanjay B 2014-02-14 13:10:42 +05:30
parent 4eefbd54bc
commit 80dbca6d82
9 changed files with 84 additions and 6 deletions

12
itf/events/search_indexes.py Executable file
View File

@ -0,0 +1,12 @@
from haystack.indexes import *
from haystack import site
from models import *
class EventIndex(SearchIndex):
text = CharField(document=True, use_template=True)
title = CharField(model_attr='title')
site.register(Event, EventIndex)

View File

@ -20,14 +20,14 @@ class ProjectIndex(SearchIndex):
intro = CharField(model_attr='intro')
class ParticipantIndex(SearchIndex):
text = CharField(document=True, use_template=True)
name = CharField(model_attr='name')
title = CharField(model_attr='title')
short_bio = CharField(model_attr='short_bio')
# class ParticipantIndex(SearchIndex):
# text = CharField(document=True, use_template=True)
# name = CharField(model_attr='name')
# title = CharField(model_attr='title')
# short_bio = CharField(model_attr='short_bio')
site.register(Meeting, MeetingIndex)
site.register(Project, ProjectIndex)
site.register(Participant, ParticipantIndex)
#site.register(Participant, ParticipantIndex)

View File

@ -0,0 +1,37 @@
from haystack.indexes import *
from haystack import site
from models import *
class PersonIndex(SearchIndex):
text = CharField(document=True, use_template=True)
title = CharField(model_attr='first_name')
'''
def index_queryset(self):
"""Used when the entire index for model is updated."""
return Note.objects.filter(pub_date__lte=datetime.datetime.now())
'''
class TheatreGroupIndex(SearchIndex):
text = CharField(document=True, use_template=True)
title = CharField(model_attr='name')
class ProductionIndex(SearchIndex):
text = CharField(document=True, use_template=True)
title = CharField(model_attr='name')
# class ParticipantIndex(SearchIndex):
# text = CharField(document=True, use_template=True)
# name = CharField(model_attr='name')
# title = CharField(model_attr='title')
# short_bio = CharField(model_attr='short_bio')
site.register(Person, PersonIndex)
site.register(TheatreGroup, TheatreGroupIndex)
site.register(Production, ProductionIndex)
#site.register(Participant, ParticipantIndex)

View File

@ -0,0 +1,14 @@
from haystack.indexes import *
from haystack import site
from models import Script
class ScriptIndex(SearchIndex):
text = CharField(document=True, use_template=True)
title = CharField(model_attr='title')
site.register(Script, ScriptIndex)
#site.register(Participant, ParticipantIndex)

View File

@ -0,0 +1,4 @@
{{ title }}
{{ oneliner }}
{{ description }}
{{ address }}

View File

@ -0,0 +1,3 @@
{{ first_name }} {{ last_name }}
{{ about }}

View File

@ -0,0 +1,3 @@
{{ name }}
{{ synopsis }}
{{ anecdotes }}

View File

@ -0,0 +1,2 @@
{{ name }}
{{ about }}

View File

@ -0,0 +1,3 @@
{{ title }}
{{ synopsis }}
{{ author }}