]> git.openstreetmap.org Git - nominatim.git/commitdiff
block search queries with too many tokens
authorSarah Hoffmann <lonvia@denofr.de>
Sat, 15 Jul 2023 14:31:39 +0000 (16:31 +0200)
committerSarah Hoffmann <lonvia@denofr.de>
Mon, 17 Jul 2023 14:27:25 +0000 (16:27 +0200)
nominatim/api/search/token_assignment.py

index c05c271a3d411dc23d084dec8266a70241a3651a..7f75505c4bfec37464fabb572281643176096477 100644 (file)
@@ -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)\