X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/df008d99f549d850d07580b4592435388e44387c..7cc8f631251b927d57f4ca19a792386cd274e504:/lib/SearchDescription.php diff --git a/lib/SearchDescription.php b/lib/SearchDescription.php index a1910231..2e72decc 100644 --- a/lib/SearchDescription.php +++ b/lib/SearchDescription.php @@ -276,11 +276,12 @@ class SearchDescription && $sPhraseType != 'country' ) { $iWordID = $aSearchTerm['word_id']; - if (sizeof($this->aName)) { - if (($sPhraseType == '' || !$bFirstPhrase) - && $sPhraseType != 'country' - && !$bHasPartial - ) { + // Full words can only be a name if they appear at the beginning + // of the phrase. In structured search the name must forcably in + // the first phrase. In unstructured search it may be in a later + // phrase when the first phrase is a house number. + if (sizeof($this->aName) || !($bFirstPhrase || $sPhraseType == '')) { + if (($sPhraseType == '' || !$bFirstPhrase) && !$bHasPartial) { $oSearch = clone $this; $oSearch->iSearchRank++; $oSearch->aAddress[$iWordID] = $iWordID; @@ -289,14 +290,10 @@ class SearchDescription $this->aFullNameAddress[$iWordID] = $iWordID; } } else { - // 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; - } + $oSearch = clone $this; + $oSearch->iSearchRank++; + $oSearch->aName = array($iWordID => $iWordID); + $aNewSearches[] = $oSearch; } }