Added parent IDs index info
authorThierry Florac <thierry.florac@onf.fr>
Fri, 30 Nov 2018 14:36:17 +0100
changeset 111 c0ce2972d333
parent 110 d1122192d6f8
child 112 88ef502db9b1
Added parent IDs index info
src/pyams_content_es/document.py
--- a/src/pyams_content_es/document.py	Mon Nov 26 11:08:36 2018 +0100
+++ b/src/pyams_content_es/document.py	Fri Nov 30 14:36:17 2018 +0100
@@ -23,6 +23,7 @@
 from pyams_content_es.interfaces import IDocumentIndexInfo, IDocumentIndexTarget
 from pyams_sequence.interfaces import ISequentialIdInfo
 from pyams_utils.adapter import adapter_config
+from pyams_utils.interfaces.traversing import IPathElements
 from pyams_utils.registry import get_utility
 from pyams_workflow.interfaces import IWorkflowState
 
@@ -90,3 +91,15 @@
                                           ESField('header'),
                                           ESField('description'),
                                           ESField('keywords', boost=2.0)))
+
+
+#
+# Content path index info
+#
+
+@adapter_config(name='path', context=IWfSharedContent, provides=IDocumentIndexInfo)
+def wf_shared_content_path_index_info(content):
+    """Shared content path index info"""
+    return {
+        'parent_ids': IPathElements(content).parents
+    }