Merge branch 'roques-tetris'

This commit is contained in:
Sarah Hoffmann
2017-04-22 18:14:05 +02:00
10 changed files with 99 additions and 71 deletions

View File

@@ -360,13 +360,13 @@ if ($aCMDResult['load-data'] || $aCMDResult['all']) {
}
echo "Load Data\n";
$sColumns = 'osm_type, osm_id, class, type, name, admin_level, address, extratags, geometry';
$aDBInstances = array();
$iLoadThreads = max(1, $iInstances - 1);
for ($i = 0; $i < $iLoadThreads; $i++) {
$aDBInstances[$i] =& getDB(true);
$sSQL = 'insert into placex (osm_type, osm_id, class, type, name, admin_level, ';
$sSQL .= ' address, extratags, geometry) ';
$sSQL .= 'select * from place where osm_id % '.$iLoadThreads.' = '.$i;
$sSQL = "INSERT INTO placex ($sColumns) SELECT $sColumns FROM place WHERE osm_id % $iLoadThreads = $i";
$sSQL .= " and not (class='place' and type='houses' and osm_type='W'";
$sSQL .= " and ST_GeometryType(geometry) = 'ST_LineString')";
$sSQL .= " and ST_IsValid(geometry)";

View File

@@ -156,16 +156,25 @@ if ($bHaveDiff) {
}
if ($aResult['deduplicate']) {
//
if (getPostgresVersion() < 9.3) {
$oDB =& getDB();
if (getPostgresVersion($oDB) < 9.3) {
fail("ERROR: deduplicate is only currently supported in postgresql 9.3");
}
$oDB =& getDB();
$sSQL = 'select partition from country_name order by country_code';
$aPartitions = chksql($oDB->getCol($sSQL));
$aPartitions[] = 0;
// we don't care about empty search_name_* artitions, they can't contain mentions of duplicates
foreach ($aPartitions as $i => $sPartition) {
$sSQL = "select count(*) from search_name_".$sPartition;
$nEntries = chksql($oDB->getOne($sSQL));
if ($nEntries == 0) {
unset($aPartitions[$i]);
}
}
$sSQL = "select word_token,count(*) from word where substr(word_token, 1, 1) = ' '";
$sSQL .= " and class is null and type is null and country_code is null";
$sSQL .= " group by word_token having count(*) > 1 order by word_token";

View File

@@ -11,7 +11,7 @@ $aCMDOptions = array(
array('quiet', 'q', 0, 1, 0, 0, 'bool', 'Quiet output'),
array('verbose', 'v', 0, 1, 0, 0, 'bool', 'Verbose output'),
array('reverse-only', '', 0, 1, 0, 0, 'bool', 'Warm reverse only'),
array('search-only', '', 0, 1, 0, 0, 'bool', 'Warm reverse only'),
array('search-only', '', 0, 1, 0, 0, 'bool', 'Warm search only'),
);
getCmdOpt($_SERVER['argv'], $aCMDOptions, $aResult, true, true);
@@ -53,7 +53,7 @@ if (!$aResult['search-only']) {
}
if (!$aResult['reverse-only']) {
$oGeocode =& new Nominatim\Geocode($oDB);
$oGeocode = new Nominatim\Geocode($oDB);
echo "Warm search: ";
if ($bVerbose) echo "\n";