]> git.openstreetmap.org Git - nominatim.git/blobdiff - lib-php/TokenCountry.php
Merge remote-tracking branch 'upstream/master'
[nominatim.git] / lib-php / TokenCountry.php
index c9b7b6af1a93b1e778f9721397dec8760809c005..3f93f45e0fe8e5ef18ca990bcf007492e2a45370 100644 (file)
@@ -1,4 +1,12 @@
 <?php
 <?php
+/**
+ * SPDX-License-Identifier: GPL-2.0-only
+ *
+ * This file is part of Nominatim. (https://nominatim.org)
+ *
+ * Copyright (C) 2022 by the Nominatim developer community.
+ * For a full list of authors see the git log.
+ */
 
 namespace Nominatim\Token;
 
 
 namespace Nominatim\Token;
 
@@ -36,7 +44,9 @@ class Country
      */
     public function isExtendable($oSearch, $oPosition)
     {
      */
     public function isExtendable($oSearch, $oPosition)
     {
-        return !$oSearch->hasCountry() && $oPosition->maybePhrase('country');
+        return !$oSearch->hasCountry()
+               && $oPosition->maybePhrase('country')
+               && $oSearch->getContext()->isCountryApplicable($this->sCountryCode);
     }
 
     /**
     }
 
     /**