diff --git a/pandora/document/models.py b/pandora/document/models.py index 6f6466f03..4d85f7854 100644 --- a/pandora/document/models.py +++ b/pandora/document/models.py @@ -30,6 +30,7 @@ from user.models import Group from . import managers from . import utils +from . import tasks from .fulltext import FulltextMixin User = get_user_model() @@ -507,7 +508,7 @@ class Document(models.Model, FulltextMixin): self.oshash = ox.oshash(self.file.path) self.save() self.delete_cache() - self.update_fulltext() + tasks.extract_fulltext.delay(self.id) return True, self.file.size return save_chunk(self, self.file, chunk, offset, name, done_cb) diff --git a/pandora/document/tasks.py b/pandora/document/tasks.py new file mode 100644 index 000000000..f08983bb2 --- /dev/null +++ b/pandora/document/tasks.py @@ -0,0 +1,8 @@ +# -*- coding: utf-8 -*- +from celery.task import task + +@task(queue="encoding") +def extract_fulltext(id): + from . import models + d = models.Document.objects.get(id=id) + d.update_fulltext()