forked from 0x2620/pandora
extract fulltext in encoding queue
This commit is contained in:
parent
390a5bc9aa
commit
234a5b67b9
2 changed files with 10 additions and 1 deletions
|
@ -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)
|
||||
|
|
8
pandora/document/tasks.py
Normal file
8
pandora/document/tasks.py
Normal 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()
|
Loading…
Reference in a new issue