]> git.openstreetmap.org Git - nominatim.git/commitdiff
for structured search only accept name terms from the first phrase
authorSarah Hoffmann <lonvia@denofr.de>
Thu, 1 Mar 2018 21:35:34 +0000 (22:35 +0100)
committerSarah Hoffmann <lonvia@denofr.de>
Thu, 1 Mar 2018 21:35:34 +0000 (22:35 +0100)
Fixes #952.

lib/SearchDescription.php

index 4ba28e352abe7dee676898a614f20494e5eac177..c379fdf3bec852895d6eca462ddee97a3d8f8d12 100644 (file)
@@ -289,10 +289,14 @@ class SearchDescription
                     $this->aFullNameAddress[$iWordID] = $iWordID;
                 }
             } else {
-                $oSearch = clone $this;
-                $oSearch->iSearchRank++;
-                $oSearch->aName = array($iWordID => $iWordID);
-                $aNewSearches[] = $oSearch;
+                // in structured search only the first phrase can be the
+                // designated name
+                if ($sPhraseType == '' || $bFirstPhrase) {
+                    $oSearch = clone $this;
+                    $oSearch->iSearchRank++;
+                    $oSearch->aName = array($iWordID => $iWordID);
+                    $aNewSearches[] = $oSearch;
+                }
             }
         }