]> git.openstreetmap.org Git - nominatim.git/blobdiff - utils/setup.php
ignore frequent partial search terms
[nominatim.git] / utils / setup.php
index 89519194a9727d7ec0f76b022c8d36586688ad84..bfc7c7205e47866b00511e763c5f5490ddeab6a6 100755 (executable)
 
        if ($aCMDResult['load-data'] || $aCMDResult['all'])
        {
 
        if ($aCMDResult['load-data'] || $aCMDResult['all'])
        {
-               echo "Load Data\n";
+               echo "Drop old Data\n";
                $bDidSomething = true;
 
                $oDB =& getDB();
                $bDidSomething = true;
 
                $oDB =& getDB();
                        echo '.';
                }
 
                        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'])
                {
                // 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++)
                {
                $aDBInstances = array();
                for($i = 0; $i < $iInstances; $i++)
                {