mirror of
https://github.com/osm-search/Nominatim.git
synced 2026-02-26 11:08:13 +00:00
block search queries with too many tokens
This commit is contained in:
@@ -265,6 +265,10 @@ class _TokenSequence:
|
|||||||
"""
|
"""
|
||||||
base = TokenAssignment.from_ranges(self.seq)
|
base = TokenAssignment.from_ranges(self.seq)
|
||||||
|
|
||||||
|
num_addr_tokens = sum(t.end - t.start for t in base.address)
|
||||||
|
if num_addr_tokens > 50:
|
||||||
|
return
|
||||||
|
|
||||||
# Postcode search (postcode-only search is covered in next case)
|
# Postcode search (postcode-only search is covered in next case)
|
||||||
if base.postcode is not None and base.address:
|
if base.postcode is not None and base.address:
|
||||||
if (base.postcode.start == 0 and self.direction != -1)\
|
if (base.postcode.start == 0 and self.direction != -1)\
|
||||||
|
|||||||
Reference in New Issue
Block a user