X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/00b05e239495fe147f9a74f0e36eb243c8a32227..2fb6018078188239a42c35327431c2becd4a3611:/lib-php/SearchDescription.php diff --git a/lib-php/SearchDescription.php b/lib-php/SearchDescription.php index 94cadda3..228b0999 100644 --- a/lib-php/SearchDescription.php +++ b/lib-php/SearchDescription.php @@ -179,6 +179,7 @@ class SearchDescription // - increase score for finding it anywhere else (optimisation) if (!$bLastToken) { $oSearch->iSearchRank += 5; + $oSearch->iNamePhrase = -1; } $aNewSearches[] = $oSearch; } @@ -205,6 +206,7 @@ class SearchDescription ) { $oSearch = clone $this; $oSearch->iSearchRank++; + $oSearch->iNamePhrase = -1; if (strlen($oSearchTerm->sPostcode) < 4) { $oSearch->iSearchRank += 4 - strlen($oSearchTerm->sPostcode); } @@ -218,6 +220,7 @@ class SearchDescription if (!$this->sHouseNumber && $this->iOperator != Operator::POSTCODE) { $oSearch = clone $this; $oSearch->iSearchRank++; + $oSearch->iNamePhrase = -1; $oSearch->sHouseNumber = $oSearchTerm->sToken; if ($this->iOperator != Operator::NONE) { $oSearch->iSearchRank++; @@ -259,6 +262,7 @@ class SearchDescription if ($this->iOperator == Operator::NONE) { $oSearch = clone $this; $oSearch->iSearchRank += 2; + $oSearch->iNamePhrase = -1; $iOp = $oSearchTerm->iOperator; if ($iOp == Operator::NONE) { @@ -268,7 +272,7 @@ class SearchDescription $iOp = Operator::NEAR; } $oSearch->iSearchRank += 2; - } else if (!$bFirstToken && !$bLastToken) { + } elseif (!$bFirstToken && !$bLastToken) { $oSearch->iSearchRank += 2; } if ($this->sHouseNumber) { @@ -293,11 +297,12 @@ class SearchDescription if (!empty($this->aName) || !($bFirstPhrase || $sPhraseType == '')) { if (($sPhraseType == '' || !$bFirstPhrase) && !$bHasPartial) { $oSearch = clone $this; + $oSearch->iNamePhrase = -1; $oSearch->iSearchRank += 3 * $oSearchTerm->iTermCount; $oSearch->aAddress[$iWordID] = $iWordID; $aNewSearches[] = $oSearch; } - } else if (empty($this->aNameNonSearch)) { + } elseif (empty($this->aNameNonSearch)) { $oSearch = clone $this; $oSearch->iSearchRank++; $oSearch->aName = array($iWordID => $iWordID); @@ -356,6 +361,7 @@ class SearchDescription if ((!$this->sPostcode && !$this->aAddress && !$this->aAddressNonSearch) && ((empty($this->aName) && empty($this->aNameNonSearch)) || $this->iNamePhrase == $iPhrase) + && strpos($sToken, ' ') === false ) { $oSearch = clone $this; $oSearch->iSearchRank++;