From 34b72591cc0ffb667708ff331ea8f6faa2f721c0 Mon Sep 17 00:00:00 2001 From: Sarah Hoffmann Date: Tue, 29 Apr 2025 15:52:57 +0200 Subject: [PATCH] exclude address searches with country from direction penalty Countries are not adequately represented by partial term counts. --- src/nominatim_api/search/token_assignment.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/nominatim_api/search/token_assignment.py b/src/nominatim_api/search/token_assignment.py index a0df7d03..4247158c 100644 --- a/src/nominatim_api/search/token_assignment.py +++ b/src/nominatim_api/search/token_assignment.py @@ -287,7 +287,7 @@ class _TokenSequence: return penalty = self.penalty - if self.direction == 1 and query.dir_penalty > 0: + if not base.country and self.direction == 1 and query.dir_penalty > 0: penalty += query.dir_penalty log().comment('first word = name') @@ -332,7 +332,7 @@ class _TokenSequence: return penalty = self.penalty - if self.direction == -1 and query.dir_penalty < 0: + if not base.country and self.direction == -1 and query.dir_penalty < 0: penalty -= query.dir_penalty if self.direction == -1 or len(base.address) > 1 or base.postcode: -- 2.39.5