(backend) Index deleted documents

Add SEARCH_INDEXER_COUNTDOWN as configurable setting.
Make the search backend creation simplier (only 'get_document_indexer' now).
Allow indexation of deleted documents.

Signed-off-by: Fabre Florian <ffabre@hybird.org>
This commit is contained in:
Fabre Florian
2025-09-24 13:44:37 +02:00
committed by Quentin BEY
parent 331a94ad2f
commit a48f61e583
11 changed files with 175 additions and 153 deletions

View File

@@ -9,7 +9,6 @@ from django.db.models import signals
from django.dispatch import receiver
from . import models
from .services.search_indexers import default_document_indexer
from .tasks.find import trigger_document_indexer
@@ -20,8 +19,7 @@ def document_post_save(sender, instance, **kwargs): # pylint: disable=unused-ar
Note : Within the transaction we can have an empty content and a serialization
error.
"""
if default_document_indexer() is not None:
transaction.on_commit(partial(trigger_document_indexer, instance))
transaction.on_commit(partial(trigger_document_indexer, instance))
@receiver(signals.post_save, sender=models.DocumentAccess)
@@ -29,5 +27,5 @@ def document_access_post_save(sender, instance, created, **kwargs): # pylint: d
"""
Asynchronous call to the document indexer at the end of the transaction.
"""
if not created and default_document_indexer() is not None:
if not created:
transaction.on_commit(partial(trigger_document_indexer, instance.document))