Rewrite the document indexer to allow single index rebuilds,
less locks and improve performance. Signed-off-by: Roberto Rosario <roberto.rosario.gonzalez@gmail.com>
This commit is contained in:
@@ -3,7 +3,9 @@ from __future__ import unicode_literals
|
||||
from django.apps import apps
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from .tasks import task_delete_empty_index_nodes, task_index_document
|
||||
from .tasks import (
|
||||
task_delete_empty, task_index_document, task_remove_document
|
||||
)
|
||||
|
||||
|
||||
def create_default_document_index(sender, **kwargs):
|
||||
@@ -31,14 +33,20 @@ def create_default_document_index(sender, **kwargs):
|
||||
)
|
||||
|
||||
|
||||
def document_created_index_update(sender, **kwargs):
|
||||
def handler_delete_empty(sender, **kwargs):
|
||||
task_delete_empty.apply_async()
|
||||
|
||||
|
||||
def handler_index_document(sender, **kwargs):
|
||||
task_index_document.apply_async(
|
||||
kwargs=dict(document_id=kwargs['instance'].pk)
|
||||
)
|
||||
|
||||
|
||||
def document_index_delete(sender, **kwargs):
|
||||
task_delete_empty_index_nodes.apply_async()
|
||||
def handler_remove_document(sender, **kwargs):
|
||||
task_remove_document.apply_async(
|
||||
kwargs=dict(document_id=kwargs['instance'].pk)
|
||||
)
|
||||
|
||||
|
||||
def document_metadata_index_update(sender, **kwargs):
|
||||
|
||||
Reference in New Issue
Block a user