From: Sarah Hoffmann Date: Fri, 6 Apr 2018 19:19:24 +0000 (+0200) Subject: Merge remote-tracking branch 'upstream/master' X-Git-Tag: deploy~339 X-Git-Url: https://git.openstreetmap.org/nominatim.git/commitdiff_plain/1e902ef60797be97f8b95cc716af01789e8be14c?hp=9b76a8ffb4c4cd13628d85c00cf286382970b149 Merge remote-tracking branch 'upstream/master' --- diff --git a/lib/Geocode.php b/lib/Geocode.php index 017d7ad9..1c84f14b 100644 --- a/lib/Geocode.php +++ b/lib/Geocode.php @@ -620,7 +620,7 @@ class Geocode } Debug::printDebugArray('Search context', $oCtx); - Debug::printDebugArray('Base search', $aSearches[0]); + Debug::printDebugArray('Base search', empty($aSearches) ? null : $aSearches[0]); Debug::printVar('Final query phrases', $aInPhrases); // Convert each phrase to standard form diff --git a/lib/output.php b/lib/output.php index fd6226bc..9d4b7502 100644 --- a/lib/output.php +++ b/lib/output.php @@ -39,3 +39,14 @@ function detailsLink($aFeature, $sTitle = false) return ''.($sTitle?$sTitle:$aFeature['place_id']).''; } + +function detailsPermaLink($aFeature, $sRefText = false) +{ + $sOSMType = formatOSMType($aFeature['osm_type'], false); + + if ($sOSMType) { + $sLabel = $sRefText ? $sRefText : $sOSMType.' '.$aFeature['osm_id']; + return ''.$sLabel.''; + } + return ''; +} diff --git a/lib/template/details-html.php b/lib/template/details-html.php index ef7d9248..00d6ba63 100644 --- a/lib/template/details-html.php +++ b/lib/template/details-html.php @@ -97,7 +97,10 @@
-

+

+ + +

diff --git a/osm2pgsql b/osm2pgsql index 00fb2505..16873879 160000 --- a/osm2pgsql +++ b/osm2pgsql @@ -1 +1 @@ -Subproject commit 00fb2505c1548a7403ce01f69e891447124235c3 +Subproject commit 16873879ba3b9d5572dcde628679bc2e448d5e86 diff --git a/settings/phrase_settings.php b/settings/phrase_settings.php index cee7028b..945235bd 100644 --- a/settings/phrase_settings.php +++ b/settings/phrase_settings.php @@ -9,7 +9,7 @@ $aTagsBlacklist 'place' => array('house', 'houses'), ); -// If a class is in the white list then all types will +// If a class is in the white list then all types will // be ignored except the ones given in the list. // Also use this list to exclude an entire class from // special phrases. diff --git a/test/php/Nominatim/NominatimTest.php b/test/php/Nominatim/LibTest.php similarity index 98% rename from test/php/Nominatim/NominatimTest.php rename to test/php/Nominatim/LibTest.php index ed738c37..ee6f94f2 100644 --- a/test/php/Nominatim/NominatimTest.php +++ b/test/php/Nominatim/LibTest.php @@ -4,15 +4,8 @@ namespace Nominatim; require_once '../../lib/lib.php'; -class NominatimTest extends \PHPUnit_Framework_TestCase +class LibTest extends \PHPUnit_Framework_TestCase { - - - protected function setUp() - { - } - - public function testGetClassTypesWithImportance() { $aClasses = getClassTypesWithImportance(); diff --git a/utils/importWikipedia.php b/utils/importWikipedia.php index 90477b81..b767adb3 100755 --- a/utils/importWikipedia.php +++ b/utils/importWikipedia.php @@ -37,7 +37,7 @@ $sTestPageText = <<getString('place_id'); $sOsmType = $oParams->getSet('osmtype', array('N', 'W', 'R')); $iOsmId = $oParams->getInt('osmid', -1); +$sClass = $oParams->getString('class'); $oDB =& getDB(); if ($sOsmType && $iOsmId > 0) { $sSQL = sprintf( - "SELECT place_id FROM placex WHERE osm_type='%s' AND osm_id=%d ORDER BY type='postcode' ASC", + "SELECT place_id FROM placex WHERE osm_type='%s' AND osm_id=%d", $sOsmType, $iOsmId ); + // osm_type and osm_id are not unique enough + if ($sClass) { + $sSQL .= " AND class='".$sClass."'"; + } + $sSQL .= ' ORDER BY class ASC'; $sPlaceId = chksql($oDB->getOne($sSQL)); // Be nice about our error messages for broken geometry @@ -210,21 +216,23 @@ $aPlaceSearchNameKeywords = false; $aPlaceSearchAddressKeywords = false; if ($oParams->getBool('keywords')) { $sSQL = "SELECT * FROM search_name WHERE place_id = $iPlaceID"; - $aPlaceSearchName = $oDB->getRow($sSQL); - if (PEAR::isError($aPlaceSearchName)) { // possible timeout + $aPlaceSearchName = $oDB->getRow($sSQL); // can be null + if (!$aPlaceSearchName || PEAR::isError($aPlaceSearchName)) { // possible timeout $aPlaceSearchName = []; } - $sSQL = 'SELECT * FROM word WHERE word_id in ('.substr($aPlaceSearchName['name_vector'], 1, -1).')'; - $aPlaceSearchNameKeywords = $oDB->getAll($sSQL); - if (PEAR::isError($aPlaceSearchNameKeywords)) { // possible timeout - $aPlaceSearchNameKeywords = []; - } + if (!empty($aPlaceSearchName)) { + $sSQL = 'SELECT * FROM word WHERE word_id in ('.substr($aPlaceSearchName['name_vector'], 1, -1).')'; + $aPlaceSearchNameKeywords = $oDB->getAll($sSQL); + if (PEAR::isError($aPlaceSearchNameKeywords)) { // possible timeout + $aPlaceSearchNameKeywords = []; + } - $sSQL = 'SELECT * FROM word WHERE word_id in ('.substr($aPlaceSearchName['nameaddress_vector'], 1, -1).')'; - $aPlaceSearchAddressKeywords = $oDB->getAll($sSQL); - if (PEAR::isError($aPlaceSearchAddressKeywords)) { // possible timeout - $aPlaceSearchAddressKeywords = []; + $sSQL = 'SELECT * FROM word WHERE word_id in ('.substr($aPlaceSearchName['nameaddress_vector'], 1, -1).')'; + $aPlaceSearchAddressKeywords = $oDB->getAll($sSQL); + if (PEAR::isError($aPlaceSearchAddressKeywords)) { // possible timeout + $aPlaceSearchAddressKeywords = []; + } } }