From cc38eb0573bd0158dee22116e009a8b9ae634805 Mon Sep 17 00:00:00 2001 From: Sanj Date: Mon, 10 Oct 2011 16:01:09 +0530 Subject: [PATCH] search stuff --- itf/festival/search_indexes.py | 26 +++++++++++++++++++ .../search/indexes/festival/meeting_text.txt | 3 +++ .../indexes/festival/participant_text.txt | 3 +++ .../search/indexes/festival/project_text.txt | 2 ++ 4 files changed, 34 insertions(+) create mode 100755 itf/festival/search_indexes.py create mode 100644 itf/templates/search/indexes/festival/meeting_text.txt create mode 100644 itf/templates/search/indexes/festival/participant_text.txt create mode 100644 itf/templates/search/indexes/festival/project_text.txt diff --git a/itf/festival/search_indexes.py b/itf/festival/search_indexes.py new file mode 100755 index 0000000..6731bf7 --- /dev/null +++ b/itf/festival/search_indexes.py @@ -0,0 +1,26 @@ +from haystack.indexes import * +from haystack import site +from models import * + + +class MeetingIndex(SearchIndex): + text = CharField(document=True, use_template=True) + + ''' + def index_queryset(self): + """Used when the entire index for model is updated.""" + return Note.objects.filter(pub_date__lte=datetime.datetime.now()) + ''' + +class ProjectIndex(SearchIndex): + text = CharField(document=True, use_template=True) + + +class ParticipantIndex(SearchIndex): + text = CharField(document=True, use_template=True) + + +site.register(Meeting, MeetingIndex) +site.register(Project, ProjectIndex) +site.register(Participant, ParticipantIndex) + diff --git a/itf/templates/search/indexes/festival/meeting_text.txt b/itf/templates/search/indexes/festival/meeting_text.txt new file mode 100644 index 0000000..91460d1 --- /dev/null +++ b/itf/templates/search/indexes/festival/meeting_text.txt @@ -0,0 +1,3 @@ +{{ object.title }} +{{ object.intro }} + diff --git a/itf/templates/search/indexes/festival/participant_text.txt b/itf/templates/search/indexes/festival/participant_text.txt new file mode 100644 index 0000000..366c30c --- /dev/null +++ b/itf/templates/search/indexes/festival/participant_text.txt @@ -0,0 +1,3 @@ +{{ object.name }} +{{ object.title }} +{{ object.short_bio }} diff --git a/itf/templates/search/indexes/festival/project_text.txt b/itf/templates/search/indexes/festival/project_text.txt new file mode 100644 index 0000000..20234d6 --- /dev/null +++ b/itf/templates/search/indexes/festival/project_text.txt @@ -0,0 +1,2 @@ +{{ object.title }} +{{ object.intro }}