From: Sarah Hoffmann Date: Thu, 13 Oct 2016 06:08:04 +0000 (+0200) Subject: Merge remote-tracking branch 'upstream/master' X-Git-Tag: deploy~412 X-Git-Url: https://git.openstreetmap.org./nominatim.git/commitdiff_plain/7486bd8c0db3f34f69125a26a1fd5d4ab36dc25a?hp=-c Merge remote-tracking branch 'upstream/master' --- 7486bd8c0db3f34f69125a26a1fd5d4ab36dc25a diff --combined lib/Geocode.php index fd381c7a,7fa349ca..b5f0c74f --- a/lib/Geocode.php +++ b/lib/Geocode.php @@@ -24,7 -24,7 +24,7 @@@ class Geocod protected $aExcludePlaceIDs = array(); protected $bDeDupe = true; - protected $bReverseInPlan = false; + protected $bReverseInPlan = true; protected $iLimit = 20; protected $iFinalLimit = 10; @@@ -180,14 -180,15 +180,15 @@@ { $this->aViewBox = array_map('floatval', $aViewbox); - if ($this->aViewBox[0] < -180 - || $this->aViewBox[2] > 180 - || $this->aViewBox[0] >= $this->aViewBox[2] - || $this->aViewBox[1] < -90 - || $this->aViewBox[3] > 90 - || $this->aViewBox[1] >= $this->aViewBox[3] + $this->aViewBox[0] = max(-180.0, min(180, $this->aViewBox[0])); + $this->aViewBox[1] = max(-90.0, min(90, $this->aViewBox[1])); + $this->aViewBox[2] = max(-180.0, min(180, $this->aViewBox[2])); + $this->aViewBox[3] = max(-90.0, min(90, $this->aViewBox[3])); + + if (abs($this->aViewBox[0] - $this->aViewBox[2]) < 0.000000001 + || abs($this->aViewBox[1] - $this->aViewBox[3]) < 0.000000001 ) { - userError("Bad parameter 'viewbox'. Out of range."); + userError("Bad parameter 'viewbox'. Not a box."); } $fHeight = $this->aViewBox[0] - $this->aViewBox[2]; @@@ -1168,20 -1169,19 +1169,20 @@@ // TODO: filter out the pointless search terms (2 letter name tokens and less) // they might be right - but they are just too darned expensive to run if (sizeof($aSearch['aName'])) $aTerms[] = "name_vector @> ARRAY[".join($aSearch['aName'], ",")."]"; - if (sizeof($aSearch['aNameNonSearch'])) $aTerms[] = "array_cat(name_vector,ARRAY[]::integer[]) @> ARRAY[".join($aSearch['aNameNonSearch'], ",")."]"; + //if (sizeof($aSearch['aNameNonSearch'])) $aTerms[] = "array_cat(name_vector,ARRAY[]::integer[]) @> ARRAY[".join($aSearch['aNameNonSearch'], ",")."]"; if (sizeof($aSearch['aAddress']) && $aSearch['aName'] != $aSearch['aAddress']) { // For infrequent name terms disable index usage for address if (CONST_Search_NameOnlySearchFrequencyThreshold && sizeof($aSearch['aName']) == 1 && $aWordFrequencyScores[$aSearch['aName'][reset($aSearch['aName'])]] < CONST_Search_NameOnlySearchFrequencyThreshold ) { - $aTerms[] = "array_cat(nameaddress_vector,ARRAY[]::integer[]) @> ARRAY[".join(array_merge($aSearch['aAddress'], $aSearch['aAddressNonSearch']), ",")."]"; + //$aTerms[] = "array_cat(nameaddress_vector,ARRAY[]::integer[]) @> ARRAY[".join(array_merge($aSearch['aAddress'], $aSearch['aAddressNonSearch']), ",")."]"; + $aTerms[] = "array_cat(nameaddress_vector,ARRAY[]::integer[]) @> ARRAY[".join($aSearch['aAddress'],",")."]"; } else { $aTerms[] = "nameaddress_vector @> ARRAY[".join($aSearch['aAddress'], ",")."]"; - if (sizeof($aSearch['aAddressNonSearch'])) { + /*if (sizeof($aSearch['aAddressNonSearch'])) { $aTerms[] = "array_cat(nameaddress_vector,ARRAY[]::integer[]) @> ARRAY[".join($aSearch['aAddressNonSearch'], ",")."]"; - } + }*/ } } if ($aSearch['sCountryCode']) $aTerms[] = "country_code = '".pg_escape_string($aSearch['sCountryCode'])."'";