--- a/docs/HISTORY.txt Wed Nov 14 17:45:43 2018 +0100
+++ b/docs/HISTORY.txt Wed Nov 14 17:46:37 2018 +0100
@@ -1,6 +1,11 @@
History
=======
+0.1.16
+------
+ - check if content indexer port is available before starting indexer process to avoid zombies
+ - updated workflow extension to handle any kind of content
+
0.1.15.1
--------
- updated external video indexer
--- a/src/pyams_content_es/document.py Wed Nov 14 17:45:43 2018 +0100
+++ b/src/pyams_content_es/document.py Wed Nov 14 17:46:37 2018 +0100
@@ -12,24 +12,19 @@
__docformat__ = 'restructuredtext'
+from pyramid.threadlocal import get_current_registry
+from pyramid_es.mixin import ESField, ESMapping, ElasticMixin as ElasticMixinBase
+from zope.interface import classImplements
+from zope.intid.interfaces import IIntIds
-# import standard library
-
-# import interfaces
+from pyams_content.shared.common import 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
from pyams_sequence.interfaces import ISequentialIdInfo
-from pyams_workflow.interfaces import IWorkflowState
-from zope.intid.interfaces import IIntIds
-
-# import packages
-from pyams_content.shared.common import WfSharedContent
from pyams_utils.adapter import adapter_config
from pyams_utils.registry import get_utility
-from pyramid.threadlocal import get_current_registry
-from pyramid_es.mixin import ElasticMixin as ElasticMixinBase, ESMapping, ESField
-from zope.interface import classImplements
+from pyams_workflow.interfaces import IWorkflowState
class ElasticMixin(ElasticMixinBase):
@@ -37,28 +32,36 @@
@property
def id(self):
- return '{oid}.{version}'.format(oid=ISequentialIdInfo(self).hex_oid,
- version=IWorkflowState(self).version_id)
+ oid = ISequentialIdInfo(self).hex_oid
+ state = IWorkflowState(self, None)
+ if state is None:
+ return oid
+ else:
+ return '{oid}.{version}'.format(oid=oid, version=state.version_id)
@property
def internal_id(self):
intids = get_utility(IIntIds)
return intids.register(self)
+ @property
+ def reference_id(self):
+ return ISequentialIdInfo(self).hex_oid
+
def elastic_mapping(self):
return IDocumentIndexInfo(self)
def elastic_document(self):
document_info = super(ElasticMixin, self).elastic_document()
registry = get_current_registry()
- for name, adapted in registry.getAdapters((self, ), IDocumentIndexInfo):
+ for name, adapted in registry.getAdapters((self,), IDocumentIndexInfo):
if not name:
continue
document_info.update(adapted)
return document_info
-WfSharedContent.__bases__ += (ElasticMixin, )
+WfSharedContent.__bases__ += (ElasticMixin,)
classImplements(WfSharedContent, IDocumentIndexTarget)
@@ -66,6 +69,7 @@
def wf_shared_content_index_info(content):
return ESMapping(analyzer='content',
properties=ESMapping(ESField('internal_id'),
+ ESField('reference_id'),
ESField('content_type'),
ESField('title', boost=3.0),
ESField('short_name'),
@@ -77,6 +81,7 @@
def wf_typed_shared_content_index_info(content):
return ESMapping(analyzer='content',
properties=ESMapping(ESField('internal_id'),
+ ESField('reference_id'),
ESField('content_type'),
ESField('data_type'),
ESField('title', boost=3.0),