mirror of
https://github.com/osm-search/Nominatim.git
synced 2026-02-16 05:18:00 +00:00
port wikipedia importance functions to python
This commit is contained in:
@@ -131,7 +131,7 @@ if ($aCMDResult['create-partition-functions'] || $aCMDResult['all']) {
|
||||
|
||||
if ($aCMDResult['import-wikipedia-articles'] || $aCMDResult['all']) {
|
||||
$bDidSomething = true;
|
||||
$oSetup->importWikipediaArticles();
|
||||
(clone($oNominatimCmd))->addParams('refresh', '--wiki-data')->run();
|
||||
}
|
||||
|
||||
if ($aCMDResult['load-data'] || $aCMDResult['all']) {
|
||||
@@ -157,7 +157,7 @@ if ($aCMDResult['index'] || $aCMDResult['all']) {
|
||||
|
||||
if ($aCMDResult['drop']) {
|
||||
$bDidSomething = true;
|
||||
$oSetup->drop($aCMDResult);
|
||||
(clone($oNominatimCmd))->addParams('freeze')->run(true);
|
||||
}
|
||||
|
||||
if ($aCMDResult['create-search-indices'] || $aCMDResult['all']) {
|
||||
@@ -172,7 +172,7 @@ if ($aCMDResult['create-country-names'] || $aCMDResult['all']) {
|
||||
|
||||
if ($aCMDResult['setup-website'] || $aCMDResult['all']) {
|
||||
$bDidSomething = true;
|
||||
$oSetup->setupWebsite();
|
||||
(clone($oNominatimCmd))->addParams('refresh', '--website')->run(true);
|
||||
}
|
||||
|
||||
// ******************************************************
|
||||
|
||||
@@ -211,20 +211,7 @@ if ($aResult['update-address-levels']) {
|
||||
}
|
||||
|
||||
if ($aResult['recompute-importance']) {
|
||||
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) =';
|
||||
$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);
|
||||
(clone($oNominatimCmd))->addParams('refresh', '--importance')->run(true);
|
||||
}
|
||||
|
||||
if ($aResult['import-osmosis'] || $aResult['import-osmosis-all']) {
|
||||
|
||||
Reference in New Issue
Block a user