mirror of
https://github.com/osm-search/Nominatim.git
synced 2026-02-26 11:08:13 +00:00
ensure that bailout-check is done after each iteration
This commit is contained in:
@@ -316,14 +316,14 @@ class SearchBuilder:
|
|||||||
rank.with_token(t, chgpenalty)))
|
rank.with_token(t, chgpenalty)))
|
||||||
elif tlist.end == trange.end:
|
elif tlist.end == trange.end:
|
||||||
ranks.extend(rank.with_token(t, 0.0) for t in tlist.tokens)
|
ranks.extend(rank.with_token(t, 0.0) for t in tlist.tokens)
|
||||||
if len(ranks) >= 10:
|
|
||||||
# Too many variants, bail out and only add
|
if len(ranks) >= 10:
|
||||||
# Worst-case Fallback: sum of penalty of partials
|
# Too many variants, bail out and only add
|
||||||
default = sum(t.penalty for t in self.query.iter_partials(trange)) + 0.2
|
# Worst-case Fallback: sum of penalty of partials
|
||||||
ranks.append(dbf.RankedTokens(rank.penalty + default, []))
|
default = sum(t.penalty for t in self.query.iter_partials(trange)) + 0.2
|
||||||
# Bail out of outer loop
|
ranks.append(dbf.RankedTokens(rank.penalty + default, []))
|
||||||
todo.clear()
|
# Bail out of outer loop
|
||||||
break
|
break
|
||||||
|
|
||||||
ranks.sort(key=lambda r: len(r.tokens))
|
ranks.sort(key=lambda r: len(r.tokens))
|
||||||
default = ranks[0].penalty + 0.3
|
default = ranks[0].penalty + 0.3
|
||||||
|
|||||||
Reference in New Issue
Block a user