Reject "ignored" shared content types from views and search folders
authorThierry Florac <tflorac@ulthar.net>
Fri, 15 Feb 2019 12:57:33 +0100
changeset 146 50e2d69f3ac7
parent 145 e4619912623d
child 147 73d8de7b1359
Reject "ignored" shared content types from views and search folders
src/pyams_content_es/shared/view/__init__.py
--- a/src/pyams_content_es/shared/view/__init__.py	Fri Jan 18 15:43:08 2019 +0100
+++ b/src/pyams_content_es/shared/view/__init__.py	Fri Feb 15 12:57:33 2019 +0100
@@ -20,6 +20,7 @@
 
 from pyams_catalog.query import CatalogResultSet
 from pyams_content.features.search import ISearchFolder
+from pyams_content.shared.common import IGNORED_CONTENT_TYPES
 from pyams_content.shared.view.interfaces import IViewQuery, \
     IViewQueryEsParamsExtension, IViewQueryFilterExtension, IViewUserQuery, IWfView, RELEVANCE_ORDER
 from pyams_content.shared.view.portlet import SEARCH_EXCLUDED_ITEMS
@@ -62,6 +63,7 @@
         if content_path is not None:
             params &= Q('term', **{'parent_ids': content_path})
         # check content types
+        params &= Q('bool', must_not=Q('terms', **{'content_type': tuple(IGNORED_CONTENT_TYPES.keys())}))
         content_types = view.get_content_types(context)
         if content_types:
             params &= Q('terms', **{'content_type': content_types})