extract fulltext in encoding queue

This commit is contained in:
j 2019-12-08 16:00:15 +00:00
parent 390a5bc9aa
commit 234a5b67b9
2 changed files with 10 additions and 1 deletions

View file

@ -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)

View file

@ -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()