Re-enable search indexing, S3 support for dev environment
authorCharles Connell <charles@connells.org>
Fri, 17 Jan 2014 20:14:06 +0000 (15:14 -0500)
committerCharles Connell <charles@connells.org>
Fri, 17 Jan 2014 20:14:12 +0000 (15:14 -0500)
karmaworld/apps/notes/management/commands/populate_indexden.py
karmaworld/apps/notes/models.py
karmaworld/apps/notes/search.py
karmaworld/settings/common.py
karmaworld/settings/prod.py
reqs/common.txt
reqs/prod.txt

index 8aefeb6f2e562fd45509b53ecc0484da8c29dff4..683f5124584c76f253723762feaac23d6e05ee7c 100644 (file)
@@ -5,7 +5,7 @@
 import traceback
 from django.core.management.base import BaseCommand
 from karmaworld.apps.notes.models import Note
-from karmaworld.apps.notes.search import *
+from karmaworld.apps.notes.search import SearchIndex
 
 class Command(BaseCommand):
     args = 'none'
@@ -14,10 +14,11 @@ class Command(BaseCommand):
            "in the index that are not overwritten will still be around."
 
     def handle(self, *args, **kwargs):
+        index = SearchIndex()
         for note in Note.objects.iterator():
             try:
                 print "Indexing {n}".format(n=note)
-                add_document(note)
+                index.add_note(note)
             except Exception, e:
                 traceback.print_exc()
                 continue
index 59625b709ca41c72e6f1d61ca92b43450a176a2d..7ce782b1431c4e6db06934dd3a19ba10b697d40a 100644 (file)
@@ -20,8 +20,6 @@ from karmaworld.apps.notes.gdrive import UPLOADED_NOTES_SESSION_KEY
 import os
 import urllib
 
-from boto.s3.acl import Grant
-
 from django.conf import settings
 from django.core.files import File
 from django.core.files.storage import FileSystemStorage
index 03bcfa3fb1507bad3ab6233c62b2982321234781..d578f5db9c5c95a54b99e1a0374e9de3f9428aa5 100644 (file)
@@ -114,7 +114,7 @@ class SearchIndex(object):
             new_note.course != old_note.course or \
             new_note.uploaded_at != old_note.uploaded_at:
             logger.info("Indexing {n}".format(n=new_note))
-            #self.index.add_document(new_note.id, SearchIndex._note_to_dict(new_note), variables={0: new_note.thanks})
+            self.index.add_document(new_note.id, SearchIndex._note_to_dict(new_note), variables={0: new_note.thanks})
 
         # If only the thanks count has changed, we can
         # just send that
index 38381ba2f097195b270419ba66522fc386cc2f5a..4c92b555dcae000afd81377d3e9e9854e79f65e4 100644 (file)
@@ -14,6 +14,7 @@ from karmaworld.secret.filepicker import FILEPICKER_API_KEY as fp_api
 
 FILEPICKER_API_KEY = fp_api
 
+from karmaworld.secret.static_s3 import *
 
 SERIALIZATION_MODULES = {'json-pretty': 'karmaworld.apps.serializers.json_pretty'}
 
index c22f17451a60a231dad2f449c41a37d0177c92ef..f80463a4eebdcceb794bf1592a5fd8bac9db134d 100644 (file)
@@ -10,8 +10,6 @@ from S3 import CallingFormat
 
 from common import *
 
-from karmaworld.secret.static_s3 import *
-
 from karmaworld.secret.db_settings import PROD_DB_NAME
 from karmaworld.secret.db_settings import PROD_DB_USERNAME
 from karmaworld.secret.db_settings import PROD_DB_PASSWORD
index fff96441d086af7389f1d78d722954e4f1703445..0656fa7afe8d94bdb7d0d873cacad7db081e129f 100644 (file)
@@ -20,3 +20,5 @@ gdshortener
 git+https://github.com/flaptor/indextank-py.git
 html2text
 django-allauth
+boto==2.6.0
+django-storages==1.1.4
index d9eff5809a55b87942c02667c0a6606583cf65af..e3fef51c2d0ee8f4f14fbb3a321c27052521dfa0 100644 (file)
@@ -1,8 +1,6 @@
 -r common.txt
-boto==2.6.0
 cssmin==0.1.4
 pylibmc==1.2.3
-django-storages==1.1.4
 gunicorn==0.14.3
 jsmin==2.0.2
 psycopg2==2.4.5