]> git.openstreetmap.org Git - nominatim.git/commitdiff
Merge remote-tracking branch 'upstream/master'
authorSarah Hoffmann <lonvia@denofr.de>
Thu, 6 Jan 2022 08:03:13 +0000 (09:03 +0100)
committerSarah Hoffmann <lonvia@denofr.de>
Thu, 6 Jan 2022 08:03:13 +0000 (09:03 +0100)
1  2 
lib-php/Geocode.php
lib-php/website/search.php
lib-sql/functions/address_lookup.sql

diff --combined lib-php/Geocode.php
index 0d1fab89b0986890c4c7537d00671944f0b27358,bf9a32625c746ab63f22effd99575d6db91dc555..a12983b15acf331a87e9952c44d5273a1b25705e
@@@ -1,4 -1,12 +1,12 @@@
  <?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;
  
@@@ -609,16 -617,15 +617,15 @@@ class Geocod
                      }
                      $aReverseGroupedSearches = $this->getGroupedSearches($aSearches, $aPhrases, $oValidTokens);
  
-                     foreach ($aGroupedSearches as $aSearches) {
+                     foreach ($aReverseGroupedSearches as $aSearches) {
                          foreach ($aSearches as $aSearch) {
-                             if (!isset($aReverseGroupedSearches[$aSearch->getRank()])) {
-                                 $aReverseGroupedSearches[$aSearch->getRank()] = array();
+                             if (!isset($aGroupedSearches[$aSearch->getRank()])) {
+                                 $aGroupedSearches[$aSearch->getRank()] = array();
                              }
-                             $aReverseGroupedSearches[$aSearch->getRank()][] = $aSearch;
+                             $aGroupedSearches[$aSearch->getRank()][] = $aSearch;
                          }
                      }
  
-                     $aGroupedSearches = $aReverseGroupedSearches;
                      ksort($aGroupedSearches);
                  }
              } else {
                          }
                      }
  
 -                    if ($iQueryLoop > 20) {
 +                    if ($iQueryLoop > 30) {
                          break;
                      }
                  }
                      $aResults = $tempIDs;
                  }
  
 -                if (!empty($aResults) || $iGroupLoop > 4 || $iQueryLoop > 30) {
 +                if (!empty($aResults) || $iGroupLoop > 6 || $iQueryLoop > 40) {
                      break;
                  }
              }
index e553ef39a3a5616419169e89e5a9085d8c947252,e8f239839835164fd98b6a54f67df0d4f13ab3f8..e1aab7940fa6770accac80578d13962d61a3b009
@@@ -1,4 -1,12 +1,12 @@@
  <?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.
+  */
  
  require_once(CONST_LibDir.'/init-website.php');
  require_once(CONST_LibDir.'/log.php');
@@@ -54,12 -62,7 +62,12 @@@ if (!$oGeocode->getQueryString(
  
  $hLog = logStart($oDB, 'search', $oGeocode->getQueryString(), $aLangPrefOrder);
  
 -$aSearchResults = $oGeocode->lookup();
 +// Ignore requests from a faulty app.
 +if ($oGeocode->getQueryString() === '-1,-1') {
 +  $aSearchResults = array();
 +} else {
 +  $aSearchResults = $oGeocode->lookup();
 +}
  
  logEnd($oDB, $hLog, count($aSearchResults));
  
index 3ea72cb190b5053d3e485c01ae27db645b2b3d38,8715798e918ce7a4779c13045abd605adc5e1bfd..e144e9fd15f5c0b960aa3ae478f558a8fcb01e2e
@@@ -1,3 -1,10 +1,10 @@@
+ -- 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.
  -- Functions for returning address information for a place.
  
  DROP TYPE IF EXISTS addressline CASCADE;
@@@ -213,7 -220,7 +220,7 @@@ BEGI
    FOR location IN
      SELECT placex.place_id, osm_type, osm_id, name, class, type,
             coalesce(extratags->'linked_place', extratags->'place') as place_type,
 -           admin_level, fromarea, isaddress,
 +           admin_level, fromarea, isaddress and linked_place_id is NULL as isaddress,
             CASE WHEN rank_address = 11 THEN 5 ELSE rank_address END as rank_address,
             distance, country_code, postcode
        FROM place_addressline join placex on (address_place_id = placex.place_id)