]> git.openstreetmap.org Git - nominatim.git/commitdiff
allow search for partials consisting of 3 or more words
authorSarah Hoffmann <lonvia@denofr.de>
Fri, 27 May 2022 14:49:14 +0000 (16:49 +0200)
committerSarah Hoffmann <lonvia@denofr.de>
Fri, 27 May 2022 14:49:14 +0000 (16:49 +0200)
The search query builder currently rejects searches for partial
names only, when the partial terms are all very frequent to avoid
queries that return too many results.

This change slightly relaxes the condition to allow the search when
there are 3 or more partial terms. With so many terms the number
of matches should be managable.

lib-php/SearchDescription.php

index 65df58ef0850b120bbc4e5a1b7b8af19dfd9ef34..3f3beab1964dd2e2578c117bac663ce9baa5535c 100644 (file)
@@ -264,6 +264,8 @@ class SearchDescription
     {
         if (empty($this->aName)) {
             $this->bNameNeedsAddress = $bNeedsAddress;
+        } elseif ($bSearchable && count($this->aName) >= 2) {
+            $this->bNameNeedsAddress = false;
         } else {
             $this->bNameNeedsAddress &= $bNeedsAddress;
         }