From 43fbd017afaba483e9ae616f676710785a843c2f Mon Sep 17 00:00:00 2001 From: Anna Trzcinska Date: Fri, 15 Nov 2019 17:00:44 +0100 Subject: [PATCH] m Signed-off-by: Anna Trzcinska --- cap/modules/schemas/models.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/cap/modules/schemas/models.py b/cap/modules/schemas/models.py index cc8d6cb6df..67bd61f10f 100644 --- a/cap/modules/schemas/models.py +++ b/cap/modules/schemas/models.py @@ -31,6 +31,7 @@ from invenio_access.permissions import authenticated_user from invenio_cache import current_cache from invenio_db import db +from invenio_jsonschemas import current_jsonschemas from invenio_jsonschemas.errors import JSONSchemaNotFound from invenio_search import current_search from invenio_search import current_search_client as es @@ -340,6 +341,14 @@ def after_record_mapping_updated(target, value, oldvalue, initiator): _recreate_record_mapping_in_ES(target, value) +@event.listens_for(Schema, 'after_update') +def after_update(target, value, schema): + """.""" + mappings_imp = current_app.config.get('SEARCH_GET_MAPPINGS_IMP') + current_cache.delete_memoized(import_string(mappings_imp)) + current_jsonschemas._get_schema_cached.cache_clear() + + @event.listens_for(Schema, 'after_delete') def before_delete_schema(mapper, connect, schema): """On schema delete, delete corresponding indexes and aliases in ES."""