Explicit document type needes to trigger indexing of documents, previously indexes with no document type associated would update for all document types

This commit is contained in:
Roberto Rosario
2015-01-07 03:39:11 -04:00
parent e75af75368
commit 5cdc95e99f
3 changed files with 5 additions and 5 deletions

View File

@@ -25,9 +25,8 @@ def index_document(document):
delete_empty_index_nodes()
# 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
for index in Index.objects.filter(Q(enabled=True) & (Q(document_types=None) | Q(document_types=document.document_type))):
# Only update indexes where the document type is found
for index in Index.objects.filter(enabled=True, document_types=document.document_type):
root_instance, created = IndexInstanceNode.objects.get_or_create(index_template_node=index.template_root, parent=None)
for template_node in index.template_root.get_children():
index_warnings = cascade_eval(document, template_node, root_instance)