exclude address searches with country from direction penalty

Countries are not adequately represented by partial term counts.
This commit is contained in:
Sarah Hoffmann
2025-04-29 15:52:57 +02:00
parent bc450d110c
commit 34b72591cc

View File

@@ -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: