From 5cdc95e99fae36bfa980520bf93e28d1cbe6880b Mon Sep 17 00:00:00 2001 From: Roberto Rosario Date: Wed, 7 Jan 2015 03:39:11 -0400 Subject: [PATCH] Explicit document type needes to trigger indexing of documents, previously indexes with no document type associated would update for all document types --- docs/releases/1.1.rst | 2 ++ mayan/apps/document_indexing/api.py | 5 ++--- mayan/apps/document_indexing/models.py | 3 +-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/releases/1.1.rst b/docs/releases/1.1.rst index af127f1461..b47eddbc29 100644 --- a/docs/releases/1.1.rst +++ b/docs/releases/1.1.rst @@ -45,6 +45,8 @@ What's new in Mayan EDMS v1.1 * Watch folders * Removal of the duplicate document search support * Removal of filesystem document indexes mirroring +* New home view +* Explicit document types needed per index Upgrading from a previous version diff --git a/mayan/apps/document_indexing/api.py b/mayan/apps/document_indexing/api.py index e85de16504..5f23d6d871 100644 --- a/mayan/apps/document_indexing/api.py +++ b/mayan/apps/document_indexing/api.py @@ -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) diff --git a/mayan/apps/document_indexing/models.py b/mayan/apps/document_indexing/models.py index 07ca68d257..c47ef32e58 100644 --- a/mayan/apps/document_indexing/models.py +++ b/mayan/apps/document_indexing/models.py @@ -44,8 +44,7 @@ class Index(models.Model): IndexTemplateNode.objects.get_or_create(parent=None, index=self) def get_document_types_names(self): - # TODO: explicit document type selection, none != all - return u', '.join([unicode(document_type) for document_type in self.document_types.all()] or [u'All']) + return u', '.join([unicode(document_type) for document_type in self.document_types.all()] or [u'None']) def natural_key(self): return (self.name,)