--- a/src/pyams_content_es/site.py Fri Feb 15 13:25:12 2019 +0100
+++ b/src/pyams_content_es/site.py Fri Mar 01 14:27:06 2019 +0100
@@ -14,13 +14,14 @@
import transaction
-from pyams_content_es.interfaces import IContentIndexerUtility, INDEXER_NAME, IDocumentIndexTarget
+from pyams_content_es.interfaces import IContentIndexerUtility, IDocumentIndexTarget, INDEXER_NAME
from pyams_content_es.utility import ContentIndexerUtility
from pyams_utils.container import find_objects_providing
from pyams_utils.interfaces.site import ISiteGenerations
-from pyams_utils.registry import utility_config, set_local_registry, query_utility
+from pyams_utils.registry import query_utility, set_local_registry, utility_config
from pyams_utils.site import check_required_utilities, site_factory
+
REQUIRED_UTILITIES = ((IContentIndexerUtility, '', ContentIndexerUtility, INDEXER_NAME),)
@@ -50,10 +51,13 @@
indexer = query_utility(IContentIndexerUtility)
if indexer is not None:
for index, document in enumerate(find_objects_providing(application, IDocumentIndexTarget)):
- print("Indexing: {0!r}".format(document))
- es_client.index_object(document)
- if not (index % 10):
- transaction.commit()
+ try:
+ print("Indexing: {0!r}".format(document))
+ es_client.index_object(document)
+ if not (index % 10):
+ transaction.commit()
+ except:
+ continue
finally:
set_local_registry(None)
transaction.commit()