mirror of
https://github.com/osm-search/Nominatim.git
synced 2026-02-26 11:08:13 +00:00
use word_token length when penalizing against postcodes
This commit is contained in:
@@ -269,10 +269,10 @@ class ICUQueryAnalyzer(AbstractQueryAnalyzer):
|
|||||||
"""
|
"""
|
||||||
for i, node, tlist in query.iter_token_lists():
|
for i, node, tlist in query.iter_token_lists():
|
||||||
if tlist.ttype == qmod.TOKEN_POSTCODE:
|
if tlist.ttype == qmod.TOKEN_POSTCODE:
|
||||||
|
tlen = len(cast(ICUToken, tlist.tokens[0]).word_token)
|
||||||
for repl in node.starting:
|
for repl in node.starting:
|
||||||
if repl.end == tlist.end and repl.ttype != qmod.TOKEN_POSTCODE \
|
if repl.end == tlist.end and repl.ttype != qmod.TOKEN_POSTCODE \
|
||||||
and (repl.ttype != qmod.TOKEN_HOUSENUMBER
|
and (repl.ttype != qmod.TOKEN_HOUSENUMBER or tlen > 4):
|
||||||
or len(tlist.tokens[0].lookup_word) > 4):
|
|
||||||
repl.add_penalty(0.39)
|
repl.add_penalty(0.39)
|
||||||
elif (tlist.ttype == qmod.TOKEN_HOUSENUMBER
|
elif (tlist.ttype == qmod.TOKEN_HOUSENUMBER
|
||||||
and len(tlist.tokens[0].lookup_word) <= 3):
|
and len(tlist.tokens[0].lookup_word) <= 3):
|
||||||
|
|||||||
Reference in New Issue
Block a user