X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/3fbba8b9db958fc9cf5b11117e814defd825dfad..c74fcda86bdad5ecd0f7e0a12fca953acaee82cb:/utils/update.php diff --git a/utils/update.php b/utils/update.php index ef7e3c9f..f71c4f43 100644 --- a/utils/update.php +++ b/utils/update.php @@ -49,6 +49,7 @@ $aCMDOptions getCmdOpt($_SERVER['argv'], $aCMDOptions, $aResult, true, true); if (!isset($aResult['index-instances'])) $aResult['index-instances'] = 1; + if (!isset($aResult['index-rank'])) $aResult['index-rank'] = 0; date_default_timezone_set('Etc/UTC'); @@ -322,12 +323,18 @@ if ($aResult['update-address-levels']) { } if ($aResult['recompute-importance']) { - echo 'Updating importance values for database.\n'; + echo "Updating importance values for database.\n"; $oDB = new Nominatim\DB(); $oDB->connect(); $sSQL = 'ALTER TABLE placex DISABLE TRIGGER ALL;'; - $sSQL .= 'UPDATE placex SET (wikipedia, importance) = (SELECT wikipedia, importance FROM compute_importance(extratags, country_code, osm_type, osm_id));'; + $sSQL .= 'UPDATE placex SET (wikipedia, importance) ='; + $sSQL .= ' (SELECT wikipedia, importance'; + $sSQL .= ' FROM compute_importance(extratags, country_code, osm_type, osm_id));'; + $sSQL .= 'UPDATE placex s SET wikipedia = d.wikipedia, importance = d.importance'; + $sSQL .= ' FROM placex d'; + $sSQL .= ' WHERE s.place_id = d.linked_place_id and d.wikipedia is not null'; + $sSQL .= ' and (s.wikipedia is null or s.importance < d.importance);'; $sSQL .= 'ALTER TABLE placex ENABLE TRIGGER ALL;'; $oDB->exec($sSQL); }