mirror of
https://github.com/osm-search/Nominatim.git
synced 2024-11-22 21:28:10 +03:00
minimum counts for tokens should always be 1
to avoid accidental devision by 0.
This commit is contained in:
parent
e53eb79923
commit
78c19bc006
@ -122,10 +122,10 @@ class ICUToken(qmod.Token):
|
||||
else:
|
||||
lookup_word = row.word_token
|
||||
|
||||
return ICUToken(penalty=penalty, token=row.word_id, count=count,
|
||||
return ICUToken(penalty=penalty, token=row.word_id, count=max(1, count),
|
||||
lookup_word=lookup_word, is_indexed=True,
|
||||
word_token=row.word_token, info=row.info,
|
||||
addr_count=addr_count)
|
||||
addr_count=max(1, addr_count))
|
||||
|
||||
|
||||
|
||||
|
@ -209,7 +209,7 @@ class LegacyQueryAnalyzer(AbstractQueryAnalyzer):
|
||||
is_indexed = False
|
||||
|
||||
return LegacyToken(penalty=penalty, token=row.word_id,
|
||||
count=row.search_name_count or 1,
|
||||
count=max(1, row.search_name_count or 1),
|
||||
addr_count=1, # not supported
|
||||
lookup_word=lookup_word,
|
||||
word_token=row.word_token.strip(),
|
||||
|
Loading…
Reference in New Issue
Block a user