From 8c6e9fc2ab06c36b79b8c6cc9c00bff83eee24d1 Mon Sep 17 00:00:00 2001 From: Nayor Date: Thu, 2 Jul 2026 00:42:27 +0200 Subject: [PATCH 1/4] fix navitia coverage not indexed in elastic --- c2corg_api/scripts/es/fill_index.py | 7 ++++++- c2corg_api/scripts/es/sync.py | 4 ++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/c2corg_api/scripts/es/fill_index.py b/c2corg_api/scripts/es/fill_index.py index 392ffb707..a6dd98be6 100644 --- a/c2corg_api/scripts/es/fill_index.py +++ b/c2corg_api/scripts/es/fill_index.py @@ -76,7 +76,12 @@ def progress(count, total_count): count = 0 with batch: for doc_type in document_types: - print('Importing document type {}'.format(doc_type)) + if doc_type not in search_documents: + # some document types (e.g. coverages) are not indexed + logging.warning('Document type {} is not indexed'.format(doc_type)) + continue + + logging.info('Importing document type {}'.format(doc_type)) to_search_document = search_documents[doc_type].to_search_document for doc in sync.get_documents(session, doc_type, batch_size, diff --git a/c2corg_api/scripts/es/sync.py b/c2corg_api/scripts/es/sync.py index 8a84e21cc..c34a7deda 100644 --- a/c2corg_api/scripts/es/sync.py +++ b/c2corg_api/scripts/es/sync.py @@ -279,6 +279,10 @@ def sync_documents(session, changed_documents, batch_size): docs_per_type = get_documents_per_type(changed_documents) add_dependent_documents(session, docs_per_type) for doc_type, document_ids in docs_per_type.items(): + if doc_type not in search_documents: + # some document types (e.g. coverages) are not indexed + logging.warning('Document type {} is not indexed'.format(doc_type)) + continue if document_ids: docs = get_documents( session, doc_type, batch_size, document_ids) From 744fe5418d9e703f4c5f630f8e111adea2d60316 Mon Sep 17 00:00:00 2001 From: Nayor Date: Thu, 2 Jul 2026 00:47:14 +0200 Subject: [PATCH 2/4] fix linter --- c2corg_api/scripts/es/fill_index.py | 3 ++- c2corg_api/scripts/es/sync.py | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/c2corg_api/scripts/es/fill_index.py b/c2corg_api/scripts/es/fill_index.py index a6dd98be6..abae3263a 100644 --- a/c2corg_api/scripts/es/fill_index.py +++ b/c2corg_api/scripts/es/fill_index.py @@ -78,7 +78,8 @@ def progress(count, total_count): for doc_type in document_types: if doc_type not in search_documents: # some document types (e.g. coverages) are not indexed - logging.warning('Document type {} is not indexed'.format(doc_type)) + logging.warning( + 'Document type {} is not indexed'.format(doc_type)) continue logging.info('Importing document type {}'.format(doc_type)) diff --git a/c2corg_api/scripts/es/sync.py b/c2corg_api/scripts/es/sync.py index c34a7deda..26793204c 100644 --- a/c2corg_api/scripts/es/sync.py +++ b/c2corg_api/scripts/es/sync.py @@ -281,7 +281,8 @@ def sync_documents(session, changed_documents, batch_size): for doc_type, document_ids in docs_per_type.items(): if doc_type not in search_documents: # some document types (e.g. coverages) are not indexed - logging.warning('Document type {} is not indexed'.format(doc_type)) + logging.warning( + 'Document type {} is not indexed'.format(doc_type)) continue if document_ids: docs = get_documents( From 7b8b9010925d770e666cc7f563eb28b7e8d2d809 Mon Sep 17 00:00:00 2001 From: Nayor Date: Thu, 2 Jul 2026 01:01:08 +0200 Subject: [PATCH 3/4] try fix tests --- c2corg_api/views/search.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/c2corg_api/views/search.py b/c2corg_api/views/search.py index e3acea9cd..43e59f0d6 100644 --- a/c2corg_api/views/search.py +++ b/c2corg_api/views/search.py @@ -27,7 +27,7 @@ @resource(path='/search', cors_policy=cors_policy) class SearchRest(object): - def __init__(self, request): + def __init__(self, request, context=None): self.request = request @view(validators=[validate_pagination, validate_preferred_lang_param]) From 8abb72322e817381a898959068d753713676cf76 Mon Sep 17 00:00:00 2001 From: Nayor Date: Thu, 2 Jul 2026 01:11:57 +0200 Subject: [PATCH 4/4] another fix.. --- c2corg_api/views/search.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/c2corg_api/views/search.py b/c2corg_api/views/search.py index 43e59f0d6..ddb1dbbbe 100644 --- a/c2corg_api/views/search.py +++ b/c2corg_api/views/search.py @@ -22,14 +22,12 @@ from c2corg_api.views.validation import validate_pagination, \ validate_preferred_lang_param from c2corg_api.views.waypoint import waypoint_documents_config +from c2corg_api.security.acl import ACLDefault from cornice.resource import resource, view @resource(path='/search', cors_policy=cors_policy) -class SearchRest(object): - def __init__(self, request, context=None): - self.request = request - +class SearchRest(ACLDefault): @view(validators=[validate_pagination, validate_preferred_lang_param]) def get(self): """Search for a query word (simple search).