changeset 392:79240675b903

For #178; using the queued_search app to update the search index. Installed redis and dependencies.
author Brian Neal <bgneal@gmail.com>
date Wed, 23 Mar 2011 02:02:44 +0000
parents 0398aae48807
children 9af6bd45c1f8
files gpp/bio/search_indexes.py gpp/downloads/search_indexes.py gpp/forums/search_indexes.py gpp/news/search_indexes.py gpp/podcast/search_indexes.py gpp/settings.py gpp/weblinks/search_indexes.py gpp/ygroup/search_indexes.py
diffstat 8 files changed, 24 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/gpp/bio/search_indexes.py	Wed Mar 23 00:44:06 2011 +0000
+++ b/gpp/bio/search_indexes.py	Wed Mar 23 02:02:44 2011 +0000
@@ -1,11 +1,12 @@
 """Haystack search index for the bio application."""
 from haystack.indexes import *
 from haystack import site
+from queued_search.indexes import QueuedSearchIndex
 
 from bio.models import UserProfile
 
 
-class UserProfileIndex(SearchIndex):
+class UserProfileIndex(QueuedSearchIndex):
     text = CharField(document=True, use_template=True)
     author = CharField(model_attr='user')
 
--- a/gpp/downloads/search_indexes.py	Wed Mar 23 00:44:06 2011 +0000
+++ b/gpp/downloads/search_indexes.py	Wed Mar 23 02:02:44 2011 +0000
@@ -1,11 +1,12 @@
 """Haystack search index for the downloads application."""
 from haystack.indexes import *
 from haystack import site
+from queued_search.indexes import QueuedSearchIndex
 
 from downloads.models import Download
 
 
-class DownloadIndex(SearchIndex):
+class DownloadIndex(QueuedSearchIndex):
     text = CharField(document=True, use_template=True)
     author = CharField(model_attr='user')
     pub_date = DateTimeField(model_attr='date_added')
--- a/gpp/forums/search_indexes.py	Wed Mar 23 00:44:06 2011 +0000
+++ b/gpp/forums/search_indexes.py	Wed Mar 23 02:02:44 2011 +0000
@@ -1,11 +1,12 @@
 """Haystack search index for the weblinks application."""
 from haystack.indexes import *
 from haystack import site
+from queued_search.indexes import QueuedSearchIndex
 
 from forums.models import Forum, Post
 
 
-class PostIndex(SearchIndex):
+class PostIndex(QueuedSearchIndex):
     text = CharField(document=True, use_template=True)
     author = CharField(model_attr='user')
     pub_date = DateTimeField(model_attr='creation_date')
--- a/gpp/news/search_indexes.py	Wed Mar 23 00:44:06 2011 +0000
+++ b/gpp/news/search_indexes.py	Wed Mar 23 02:02:44 2011 +0000
@@ -1,10 +1,12 @@
 """Haystack search index for the news application."""
 from haystack.indexes import *
 from haystack import site
+from queued_search.indexes import QueuedSearchIndex
+
 from news.models import Story
 
 
-class StoryIndex(SearchIndex):
+class StoryIndex(QueuedSearchIndex):
     text = CharField(document=True, use_template=True)
     author = CharField(model_attr='submitter')
     pub_date = DateTimeField(model_attr='date_submitted')
--- a/gpp/podcast/search_indexes.py	Wed Mar 23 00:44:06 2011 +0000
+++ b/gpp/podcast/search_indexes.py	Wed Mar 23 02:02:44 2011 +0000
@@ -1,10 +1,12 @@
 """Haystack search index for the news application."""
 from haystack.indexes import *
 from haystack import site
+from queued_search.indexes import QueuedSearchIndex
+
 from podcast.models import Item
 
 
-class ItemIndex(SearchIndex):
+class ItemIndex(QueuedSearchIndex):
     text = CharField(document=True, use_template=True)
     author = CharField(model_attr='author')
     pub_date = DateTimeField(model_attr='pubdate')
--- a/gpp/settings.py	Wed Mar 23 00:44:06 2011 +0000
+++ b/gpp/settings.py	Wed Mar 23 02:02:44 2011 +0000
@@ -134,6 +134,7 @@
     'elsewhere',
     'tagging',
     'haystack',
+    'queued_search',
     'accounts',
     'antispam',
     'bio',
@@ -265,6 +266,13 @@
     DEBUG_TOOLBAR_CONFIG = local_settings.DEBUG_TOOLBAR_CONFIG
 
 #######################################################################
+# Asynchronous settings (queues, queued_search, redis, celery, etc)
+#######################################################################
+QUEUE_BACKEND = 'redisd'
+QUEUE_REDIS_CONNECTION = 'localhost:6379'
+QUEUE_REDIS_DB = 0
+
+#######################################################################
 # URL's of 3rd party Javascript and CSS files.
 # These dictionaries are used by core/templatetags/script_tags, and
 # should also be used by developers when creating form media classes.
--- a/gpp/weblinks/search_indexes.py	Wed Mar 23 00:44:06 2011 +0000
+++ b/gpp/weblinks/search_indexes.py	Wed Mar 23 02:02:44 2011 +0000
@@ -1,11 +1,12 @@
 """Haystack search index for the weblinks application."""
 from haystack.indexes import *
 from haystack import site
+from queued_search.indexes import QueuedSearchIndex
 
 from weblinks.models import Link
 
 
-class LinkIndex(SearchIndex):
+class LinkIndex(QueuedSearchIndex):
     text = CharField(document=True, use_template=True)
     author = CharField(model_attr='user')
     pub_date = DateTimeField(model_attr='date_added')
--- a/gpp/ygroup/search_indexes.py	Wed Mar 23 00:44:06 2011 +0000
+++ b/gpp/ygroup/search_indexes.py	Wed Mar 23 02:02:44 2011 +0000
@@ -4,11 +4,12 @@
 """
 from haystack.indexes import *
 from haystack import site
+from queued_search.indexes import QueuedSearchIndex
 
 from ygroup.models import Post
 
 
-class PostIndex(SearchIndex):
+class PostIndex(QueuedSearchIndex):
     text = CharField(document=True, use_template=True)
     pub_date = DateTimeField(model_attr='creation_date')