From 90d07b5ea1b7bc7bca98966b500583018dc6feda Mon Sep 17 00:00:00 2001 From: genja Date: Sun, 19 Jul 2026 20:17:50 +0200 Subject: [PATCH] change names matching to match_phrase --- .../inse/projects/projects_search_client.py | 24 ++++--------------- 1 file changed, 5 insertions(+), 19 deletions(-) diff --git a/service/src/main/inse/projects/projects_search_client.py b/service/src/main/inse/projects/projects_search_client.py index 01a36348..d12b5c5f 100644 --- a/service/src/main/inse/projects/projects_search_client.py +++ b/service/src/main/inse/projects/projects_search_client.py @@ -665,33 +665,18 @@ async def search_dfg_projects( ) if names: name_must_clauses = [] - for full_name in names: - name_parts = full_name.strip().split() - if not name_parts: + full_name = full_name.strip() + if not full_name: continue - match_musts = [] - - for part in name_parts: - match_musts.append( - { - "match": { - "persons.full_name": { - "query": part, - "operator": "and", - } - } - } - ) - name_must_clauses.append( { "nested": { "path": "persons", "query": { - "bool": { - "must": match_musts + "match_phrase": { + "persons.full_name": full_name } }, } @@ -779,6 +764,7 @@ async def search_dfg_projects( sort_config = {"id": {"order": sort_direction}} body["sort"] = [sort_config] + print(body) response = await elasticsearch.search( index=ESIndex.PROJECTS_DFG_ALL, body=body,