# HG changeset patch # User Thierry Florac # Date 1595093878 -7200 # Node ID 838fd9ca54fbe51a643a4bf9b01bcc4abe567a48 # Parent 41093bb671a54d7339b3ef1cacd7e71c36ec53ce Added owner ID field to index mapping diff -r 41093bb671a5 -r 838fd9ca54fb docs/mappings/index-settings.json --- a/docs/mappings/index-settings.json Fri Jul 17 08:57:45 2020 +0200 +++ b/docs/mappings/index-settings.json Sat Jul 18 19:37:58 2020 +0200 @@ -92,6 +92,9 @@ "data_type": { "type": "keyword" }, + "owner_id": { + "type": "keyword" + }, "title": { "type": "object", "properties": { diff -r 41093bb671a5 -r 838fd9ca54fb src/pyams_content_es/document.py --- a/src/pyams_content_es/document.py Fri Jul 17 08:57:45 2020 +0200 +++ b/src/pyams_content_es/document.py Sat Jul 18 19:37:58 2020 +0200 @@ -17,7 +17,7 @@ from zope.interface import classImplements from zope.intid.interfaces import IIntIds -from pyams_content.shared.common import WfSharedContent +from pyams_content.shared.common import IWfSharedContentRoles, WfSharedContent 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 @@ -49,6 +49,10 @@ def reference_id(self): return ISequentialIdInfo(self).hex_oid + @property + def owner_id(self): + return list(IWfSharedContentRoles(self).owner or ()) + def elastic_mapping(self): return IDocumentIndexInfo(self) @@ -71,6 +75,7 @@ return ESMapping(analyzer='content', properties=ESMapping(ESField('internal_id'), ESField('reference_id'), + ESField('owner_id'), ESField('content_type'), ESField('title', boost=3.0), ESField('short_name'), @@ -84,6 +89,7 @@ return ESMapping(analyzer='content', properties=ESMapping(ESField('internal_id'), ESField('reference_id'), + ESField('owner_id'), ESField('content_type'), ESField('data_type'), ESField('title', boost=3.0),