X-Git-Url: https://git.openstreetmap.org/nominatim.git/blobdiff_plain/7ff1395b96317bdc28a8dffd2351a4d9368e218a..8fc2f9551bb056f2dcdd8f85f168ca956015e266:/utils/setup.php diff --git a/utils/setup.php b/utils/setup.php index 1db725c4..bfc7c720 100755 --- a/utils/setup.php +++ b/utils/setup.php @@ -271,7 +271,7 @@ if ($aCMDResult['load-data'] || $aCMDResult['all']) { - echo "Load Data\n"; + echo "Drop old Data\n"; $bDidSomething = true; $oDB =& getDB(); @@ -307,17 +307,18 @@ echo '.'; } + // used by getorcreate_word_id to ignore frequent partial words + if (!pg_query($oDB->connection, 'CREATE OR REPLACE FUNCTION get_maxwordfreq() RETURNS integer AS $$ SELECT '.CONST_Max_Word_Frequency.' as maxwordfreq; $$ LANGUAGE SQL IMMUTABLE')) fail(pg_last_error($oDB->connection)); + echo ".\n"; + // pre-create the word list if (!$aCMDResult['disable-token-precalc']) { - if (!pg_query($oDB->connection, 'select count(make_keywords(v)) from (select distinct svals(name) as v from place) as w where v is not null;')) fail(pg_last_error($oDB->connection)); - echo '.'; - if (!pg_query($oDB->connection, 'select count(make_keywords(v)) from (select distinct postcode as v from place) as w where v is not null;')) fail(pg_last_error($oDB->connection)); - echo '.'; - if (!pg_query($oDB->connection, 'select count(getorcreate_housenumber_id(v)) from (select distinct housenumber as v from place where housenumber is not null) as w;')) fail(pg_last_error($oDB->connection)); - echo '.'; + echo "Loading word list\n"; + pgsqlRunScriptFile(CONST_BasePath.'/data/words.sql'); } + echo "Load Data\n"; $aDBInstances = array(); for($i = 0; $i < $iInstances; $i++) { @@ -457,7 +458,12 @@ if (!file_exists(CONST_Osmosis_Binary)) fail("please download osmosis"); if (file_exists(CONST_BasePath.'/settings/configuration.txt')) echo "settings/configuration.txt already exists\n"; - else passthru(CONST_Osmosis_Binary.' --read-replication-interval-init '.CONST_BasePath.'/settings'); + else + { + passthru(CONST_Osmosis_Binary.' --read-replication-interval-init '.CONST_BasePath.'/settings'); + // server layout changed afer license change, fix path to minutely diffs + passthru("sed -i 's:minute-replicate:replication/minute:' ".CONST_BasePath.'/settings/configuration.txt'); + } $sDate = $aCMDResult['osmosis-init-date']; $aDate = date_parse_from_format("Y-m-d\TH-i", $sDate);