From: Sarah Hoffmann Date: Sat, 15 Jul 2023 14:31:39 +0000 (+0200) Subject: block search queries with too many tokens X-Git-Tag: v4.3.0~51^2~4 X-Git-Url: https://git.openstreetmap.org./nominatim.git/commitdiff_plain/412bd2ec20575277970beed40e46912d2d7b9f6d block search queries with too many tokens --- diff --git a/nominatim/api/search/token_assignment.py b/nominatim/api/search/token_assignment.py index c05c271a..7f75505c 100644 --- a/nominatim/api/search/token_assignment.py +++ b/nominatim/api/search/token_assignment.py @@ -265,6 +265,10 @@ class _TokenSequence: """ 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) if base.postcode is not None and base.address: if (base.postcode.start == 0 and self.direction != -1)\