Fix function name, delete a document from all index nodes before reindexing it
This commit is contained in:
@@ -13,7 +13,7 @@ logger = logging.getLogger(__name__)
|
|||||||
|
|
||||||
|
|
||||||
# External functions
|
# External functions
|
||||||
def update_indexes(document):
|
def index_document(document):
|
||||||
"""
|
"""
|
||||||
Update or create all the index instances related to a document
|
Update or create all the index instances related to a document
|
||||||
"""
|
"""
|
||||||
@@ -21,6 +21,9 @@ def update_indexes(document):
|
|||||||
|
|
||||||
warnings = []
|
warnings = []
|
||||||
|
|
||||||
|
for index_node in IndexInstanceNode.objects.filter(documents=document):
|
||||||
|
index_node.documents.remove(document)
|
||||||
|
|
||||||
# Only update indexes where the document type is found or that do not have any document type specified
|
# Only update indexes where the document type is found or that do not have any document type specified
|
||||||
# TODO: explicit document type selection, none != all
|
# TODO: explicit document type selection, none != all
|
||||||
for index in Index.objects.filter(Q(enabled=True) & (Q(document_types=None) | Q(document_types=document.document_type))):
|
for index in Index.objects.filter(Q(enabled=True) & (Q(document_types=None) | Q(document_types=document.document_type))):
|
||||||
@@ -86,4 +89,4 @@ def task_delete_empty_index_nodes_recursive(instance_node):
|
|||||||
# same conditions
|
# same conditions
|
||||||
parent = instance_node.parent
|
parent = instance_node.parent
|
||||||
instance_node.delete()
|
instance_node.delete()
|
||||||
delete_empty_indexes(parent)
|
task_delete_empty_index_nodes_recursive(parent)
|
||||||
|
|||||||
Reference in New Issue
Block a user