Added typed shared content support
authorThierry Florac <thierry.florac@onf.fr>
Wed, 11 Jul 2018 15:21:28 +0200
changeset 76 d3c79177aef3
parent 75 a4a2dc04040c
child 77 43a9b140bc89
Added typed shared content support
src/pyams_content_es/document.py
--- a/src/pyams_content_es/document.py	Wed Jul 11 15:21:02 2018 +0200
+++ b/src/pyams_content_es/document.py	Wed Jul 11 15:21:28 2018 +0200
@@ -17,6 +17,7 @@
 
 # import interfaces
 from pyams_content.shared.common.interfaces import IWfSharedContent
+from pyams_content.shared.common.interfaces.types import IWfTypedSharedContent
 from pyams_content_es.interfaces import IDocumentIndexInfo, IDocumentIndexTarget
 from pyams_sequence.interfaces import ISequentialIdInfo
 from pyams_workflow.interfaces import IWorkflowState
@@ -70,3 +71,15 @@
                                           ESField('short_name'),
                                           ESField('description'),
                                           ESField('keywords', boost=2.0)))
+
+
+@adapter_config(context=IWfTypedSharedContent, provides=IDocumentIndexInfo)
+def wf_typed_shared_content_index_info(content):
+    return ESMapping(analyzer='content',
+                     properties=ESMapping(ESField('internal_id'),
+                                          ESField('content_type'),
+                                          ESField('data_type'),
+                                          ESField('title', boost=3.0),
+                                          ESField('short_name'),
+                                          ESField('description'),
+                                          ESField('keywords', boost=2.0)))