From 80dbca6d82c1aff994e84a88d5660ab8dede0c71 Mon Sep 17 00:00:00 2001 From: Sanjay B Date: Fri, 14 Feb 2014 13:10:42 +0530 Subject: [PATCH] add search indexes for all apps --- itf/events/search_indexes.py | 12 ++++++ itf/festival/search_indexes.py | 12 +++--- itf/itfprofiles/search_indexes.py | 37 +++++++++++++++++++ itf/scriptbank/search_indexes.py | 14 +++++++ .../search/indexes/events/event_text.txt | 4 ++ .../indexes/itfprofiles/person_text.txt | 3 ++ .../indexes/itfprofiles/production_text.txt | 3 ++ .../indexes/itfprofiles/theatregroup_text.txt | 2 + .../search/indexes/scriptbank/script_text.txt | 3 ++ 9 files changed, 84 insertions(+), 6 deletions(-) create mode 100755 itf/events/search_indexes.py create mode 100755 itf/itfprofiles/search_indexes.py create mode 100755 itf/scriptbank/search_indexes.py create mode 100644 itf/templates/search/indexes/events/event_text.txt create mode 100644 itf/templates/search/indexes/itfprofiles/person_text.txt create mode 100644 itf/templates/search/indexes/itfprofiles/production_text.txt create mode 100644 itf/templates/search/indexes/itfprofiles/theatregroup_text.txt create mode 100644 itf/templates/search/indexes/scriptbank/script_text.txt diff --git a/itf/events/search_indexes.py b/itf/events/search_indexes.py new file mode 100755 index 0000000..568c89f --- /dev/null +++ b/itf/events/search_indexes.py @@ -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) + diff --git a/itf/festival/search_indexes.py b/itf/festival/search_indexes.py index 30890ce..82da9a5 100755 --- a/itf/festival/search_indexes.py +++ b/itf/festival/search_indexes.py @@ -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) diff --git a/itf/itfprofiles/search_indexes.py b/itf/itfprofiles/search_indexes.py new file mode 100755 index 0000000..ca81511 --- /dev/null +++ b/itf/itfprofiles/search_indexes.py @@ -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) + diff --git a/itf/scriptbank/search_indexes.py b/itf/scriptbank/search_indexes.py new file mode 100755 index 0000000..a5a6c2f --- /dev/null +++ b/itf/scriptbank/search_indexes.py @@ -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) + diff --git a/itf/templates/search/indexes/events/event_text.txt b/itf/templates/search/indexes/events/event_text.txt new file mode 100644 index 0000000..83d70db --- /dev/null +++ b/itf/templates/search/indexes/events/event_text.txt @@ -0,0 +1,4 @@ +{{ title }} +{{ oneliner }} +{{ description }} +{{ address }} \ No newline at end of file diff --git a/itf/templates/search/indexes/itfprofiles/person_text.txt b/itf/templates/search/indexes/itfprofiles/person_text.txt new file mode 100644 index 0000000..5dd8052 --- /dev/null +++ b/itf/templates/search/indexes/itfprofiles/person_text.txt @@ -0,0 +1,3 @@ +{{ first_name }} {{ last_name }} + +{{ about }} \ No newline at end of file diff --git a/itf/templates/search/indexes/itfprofiles/production_text.txt b/itf/templates/search/indexes/itfprofiles/production_text.txt new file mode 100644 index 0000000..ae975ea --- /dev/null +++ b/itf/templates/search/indexes/itfprofiles/production_text.txt @@ -0,0 +1,3 @@ +{{ name }} +{{ synopsis }} +{{ anecdotes }} \ No newline at end of file diff --git a/itf/templates/search/indexes/itfprofiles/theatregroup_text.txt b/itf/templates/search/indexes/itfprofiles/theatregroup_text.txt new file mode 100644 index 0000000..e9f031a --- /dev/null +++ b/itf/templates/search/indexes/itfprofiles/theatregroup_text.txt @@ -0,0 +1,2 @@ +{{ name }} +{{ about }} diff --git a/itf/templates/search/indexes/scriptbank/script_text.txt b/itf/templates/search/indexes/scriptbank/script_text.txt new file mode 100644 index 0000000..69009a6 --- /dev/null +++ b/itf/templates/search/indexes/scriptbank/script_text.txt @@ -0,0 +1,3 @@ +{{ title }} +{{ synopsis }} +{{ author }} \ No newline at end of file