diff --git a/rero_ils/modules/documents/views.py b/rero_ils/modules/documents/views.py index cbfecdd215..9846a4fda7 100644 --- a/rero_ils/modules/documents/views.py +++ b/rero_ils/modules/documents/views.py @@ -78,7 +78,8 @@ def doc_item_view_method(pid, record, template=None, **kwargs): pid=pid, record=record, holdings=holdings, - viewcode=viewcode + viewcode=viewcode, + recordType='documents' ) diff --git a/rero_ils/modules/indexer_utils.py b/rero_ils/modules/indexer_utils.py index 6d5eefa2e8..60261fa151 100644 --- a/rero_ils/modules/indexer_utils.py +++ b/rero_ils/modules/indexer_utils.py @@ -41,6 +41,10 @@ def record_to_index(record): # put all document in the same index if re.search(r'/documents/', schema): schema = re.sub(r'-.*\.json', '.json', schema) + # authorities specific transformation + if re.search(r'/authorities/', schema): + schema = re.sub(r'/authorities/', '/persons/', schema) + schema = re.sub(r'mef-person', 'mef_person', schema) index, doc_type = schema_to_index(schema, index_names=index_names) if index and doc_type: diff --git a/tests/ui/test_indexer_utils.py b/tests/ui/test_indexer_utils.py index 39ded202ec..0ad2ab3a21 100644 --- a/tests/ui/test_indexer_utils.py +++ b/tests/ui/test_indexer_utils.py @@ -29,6 +29,12 @@ def test_record_to_index(app): 'documents/document-minimal-v0.0.1.json' }) == ('documents-document', 'document') + # for mef-persons + assert record_to_index({ + '$schema': 'http://mef.rero.ch/schemas/' + 'authorities/mef-person-v0.0.1.json' + }) == ('persons-mef_person-v0.0.1', 'mef_person-v0.0.1') + # for others assert record_to_index({ '$schema': 'https://ils.rero.ch/schema/'