superfastmatch

This commit is contained in:
James Turk 2012-04-16 17:08:25 -04:00
parent 97e164e6e6
commit 85d88c1c94
2 changed files with 23 additions and 1 deletions

View File

@ -3,9 +3,10 @@ oyster changelog
0.3.3
-----
**2012-04-16**
* S3 storage backend bugfix
* improvements to signal script
* oyster.ext additions
* oyster.ext cloudsearch and superfastmatch
0.3.2
-----

View File

@ -0,0 +1,21 @@
from celery.task.base import Task
from ..core import kernel
from ..conf import settings
from superfastmatch import Client
sfm = Client(settings.SUPERFASTMATCH_URL)
class SuperFastMatchPush(Task):
""" task that pushes documents to SFM """
# results go straight to database
ignore_result = True
def run(self, doc_id):
doc = kernel.db.tracked.find_one({'_id': doc_id})
text = kernel.extract_text(doc)
doctype, docid = settings.SUPERFASTMATCH_ID_FUNC(doc_id)
sfm.add(doctype, docid, text, **doc['metadata'])