]> git.openstreetmap.org Git - nominatim.git/blobdiff - lib-php/TokenSpecialTerm.php
Merge pull request #2484 from lonvia/fix-index-use
[nominatim.git] / lib-php / TokenSpecialTerm.php
index 5b2d4c70a64f75de8971da78500bc2b8ad65e331..6eb2ede341a21b2a51da6646431a8c5fd41c16f1 100644 (file)
@@ -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;
         }