X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/73953cbac95847740339d7a5ee3c0e5f142d93c5..aca6439eb7bc2cc6a6c2d7df0ebdb299c96c9c41:/lib-php/TokenSpecialTerm.php?ds=inline diff --git a/lib-php/TokenSpecialTerm.php b/lib-php/TokenSpecialTerm.php index 5b2d4c70..6eb2ede3 100644 --- a/lib-php/TokenSpecialTerm.php +++ b/lib-php/TokenSpecialTerm.php @@ -44,7 +44,10 @@ class SpecialTerm */ public function isExtendable($oSearch, $oPosition) { - return !$oSearch->hasOperator() && $oPosition->isPhrase(''); + return !$oSearch->hasOperator() + && $oPosition->isPhrase('') + && ($this->iOperator != \Nominatim\Operator::NONE + || (!$oSearch->hasAddress() && !$oSearch->hasHousenumber() && !$oSearch->hasCountry())); } /** @@ -66,8 +69,8 @@ class SpecialTerm $iOp = \Nominatim\Operator::NAME; } else { $iOp = \Nominatim\Operator::NEAR; + $iSearchCost += 2; } - $iSearchCost += 2; } elseif (!$oPosition->isFirstToken() && !$oPosition->isLastToken()) { $iSearchCost += 2; }