mirror of
https://github.com/osm-search/Nominatim.git
synced 2026-03-12 05:44:06 +00:00
Fix bug in index.c and remove column admin_level from location_property_osmline.
This commit is contained in:
@@ -1331,11 +1331,11 @@
|
|||||||
{
|
{
|
||||||
$sHouseNumberRegex = '\\\\m'.$aSearch['sHouseNumber'].'\\\\M';
|
$sHouseNumberRegex = '\\\\m'.$aSearch['sHouseNumber'].'\\\\M';
|
||||||
$aOrder[] = "";
|
$aOrder[] = "";
|
||||||
$aOrder[0] = " exists(select place_id from placex where parent_place_id = search_name.place_id";
|
$aOrder[0] = " (exists(select place_id from placex where parent_place_id = search_name.place_id";
|
||||||
$aOrder[0] .= " and transliteration(housenumber) ~* E'".$sHouseNumberRegex."' limit 1) ";
|
$aOrder[0] .= " and transliteration(housenumber) ~* E'".$sHouseNumberRegex."' limit 1) ";
|
||||||
// also housenumbers from interpolation lines table are needed
|
// also housenumbers from interpolation lines table are needed
|
||||||
$aOrder[0] .= " or exists(select place_id from location_property_osmline where parent_place_id = search_name.place_id";
|
$aOrder[0] .= " or exists(select place_id from location_property_osmline where parent_place_id = search_name.place_id";
|
||||||
$aOrder[0] .= " and ".intval($aSearch['sHouseNumber']).">=startnumber and ".intval($aSearch['sHouseNumber'])."<=endnumber limit 1)";
|
$aOrder[0] .= " and ".intval($aSearch['sHouseNumber']).">=startnumber and ".intval($aSearch['sHouseNumber'])."<=endnumber limit 1))";
|
||||||
$aOrder[0] .= " desc";
|
$aOrder[0] .= " desc";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -156,14 +156,14 @@ struct index_thread_data * thread_data, const char *structuredoutputfile)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
iResult = PQsendQueryPrepared(conn, "index_nosector_places", 1, paramValues, paramLengths, paramFormats, 1);
|
iResult = PQsendQueryPrepared(conn, "index_nosector_places", 2, paramValues, paramLengths, paramFormats, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (interpolation)
|
if (interpolation)
|
||||||
{
|
{
|
||||||
iResult = PQsendQueryPrepared(conn, "index_sector_places_osmline", 1, paramValues, paramLengths, paramFormats, 1);
|
iResult = PQsendQueryPrepared(conn, "index_sector_places_osmline", 2, paramValues, paramLengths, paramFormats, 1);
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -216,7 +216,15 @@ struct index_thread_data * thread_data, const char *structuredoutputfile)
|
|||||||
if (sleepcount++ > 500)
|
if (sleepcount++ > 500)
|
||||||
{
|
{
|
||||||
rankPerSecond = ((float)rankCountTuples + (float)count) / MAX(difftime(time(0), rankStartTime),1);
|
rankPerSecond = ((float)rankCountTuples + (float)count) / MAX(difftime(time(0), rankStartTime),1);
|
||||||
fprintf(stderr, " Done %i in %i @ %f per second - Rank %i ETA (seconds): %f\n", (rankCountTuples + count), (int)(difftime(time(0), rankStartTime)), rankPerSecond, rank, ((float)(rankTotalTuples - (rankCountTuples + count)))/rankPerSecond);
|
if(interpolation)
|
||||||
|
{
|
||||||
|
fprintf(stderr, " Done %i in %i @ %f per second - Interpolation lines ETA (seconds): %f\n", (rankCountTuples + count), (int)(difftime(time(0), rankStartTime)), rankPerSecond, ((float)(rankTotalTuples - (rankCountTuples + count)))/rankPerSecond);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fprintf(stderr, " Done %i in %i @ %f per second - Rank %i ETA (seconds): %f\n", (rankCountTuples + count), (int)(difftime(time(0), rankStartTime)), rankPerSecond, rank, ((float)(rankTotalTuples - (rankCountTuples + count)))/rankPerSecond);
|
||||||
|
}
|
||||||
|
|
||||||
sleepcount = 0;
|
sleepcount = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -327,7 +335,7 @@ void nominatim_index(int rank_min, int rank_max, int num_threads, const char *co
|
|||||||
|
|
||||||
pg_prepare_params[0] = PG_OID_INT4;
|
pg_prepare_params[0] = PG_OID_INT4;
|
||||||
res = PQprepare(conn, "index_sector_places_osmline",
|
res = PQprepare(conn, "index_sector_places_osmline",
|
||||||
"select place_id from location_property_osmline where geometry_sector = $1 and indexed_status > 0",
|
"select place_id from location_property_osmline where geometry_sector = $2 and indexed_status > 0",
|
||||||
1, pg_prepare_params);
|
1, pg_prepare_params);
|
||||||
if (PQresultStatus(res) != PGRES_COMMAND_OK)
|
if (PQresultStatus(res) != PGRES_COMMAND_OK)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -734,9 +734,9 @@ BEGIN
|
|||||||
and place_id != prevnode.place_id and class = 'place'
|
and place_id != prevnode.place_id and class = 'place'
|
||||||
and type = 'house';
|
and type = 'house';
|
||||||
insert into location_property_osmline
|
insert into location_property_osmline
|
||||||
values (sectiongeo, nextval('seq_place'), partition, wayid, NULL, startnumber, endnumber, interpolationtype, prevnode.admin_level,
|
values (sectiongeo, nextval('seq_place'), partition, wayid, NULL, startnumber, endnumber,
|
||||||
street, coalesce(prevnode.postcode, defpostalcode),
|
interpolationtype, street, coalesce(prevnode.postcode, defpostalcode),
|
||||||
calculated_country_code, geometry_sector, 2, now());
|
calculated_country_code, geometry_sector, 2, now());
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
-- early break if we are out of line string,
|
-- early break if we are out of line string,
|
||||||
|
|||||||
@@ -17,6 +17,11 @@ CREATE INDEX idx_placex_parent_place_id ON placex USING BTREE (parent_place_id)
|
|||||||
CREATE INDEX idx_placex_reverse_geometry ON placex USING gist (geometry) {ts:search-index} where rank_search != 28 and (name is not null or housenumber is not null) and class not in ('waterway','railway','tunnel','bridge','man_made');
|
CREATE INDEX idx_placex_reverse_geometry ON placex USING gist (geometry) {ts:search-index} where rank_search != 28 and (name is not null or housenumber is not null) and class not in ('waterway','railway','tunnel','bridge','man_made');
|
||||||
CREATE INDEX idx_location_area_country_place_id ON location_area_country USING BTREE (place_id) {ts:address-index};
|
CREATE INDEX idx_location_area_country_place_id ON location_area_country USING BTREE (place_id) {ts:address-index};
|
||||||
|
|
||||||
|
CREATE UNIQUE INDEX idx_osmline_place_id ON location_property_osmline USING BTREE (place_id) {ts:search-index};
|
||||||
|
CREATE INDEX idx_osmline_parent_place_id ON location_property_osmline USING BTREE (parent_place_id) {ts:search-index};
|
||||||
|
CREATE INDEX idx_osmline_geometry_sector ON location_property_osmline USING BTREE (geometry_sector) {ts:address-index};
|
||||||
|
CREATE INDEX idx_osmline_linegeo ON location_property_osmline USING GIST (linegeo) {ts:search-index};
|
||||||
|
|
||||||
CREATE INDEX idx_search_name_country_centroid ON search_name_country USING GIST (centroid) {ts:address-index};
|
CREATE INDEX idx_search_name_country_centroid ON search_name_country USING GIST (centroid) {ts:address-index};
|
||||||
|
|
||||||
DROP INDEX IF EXISTS place_id_idx;
|
DROP INDEX IF EXISTS place_id_idx;
|
||||||
|
|||||||
@@ -94,7 +94,6 @@ CREATE TABLE location_property_osmline (
|
|||||||
startnumber INTEGER,
|
startnumber INTEGER,
|
||||||
endnumber INTEGER,
|
endnumber INTEGER,
|
||||||
interpolationtype TEXT,
|
interpolationtype TEXT,
|
||||||
admin_level INTEGER,
|
|
||||||
street TEXT,
|
street TEXT,
|
||||||
postcode TEXT,
|
postcode TEXT,
|
||||||
calculated_country_code VARCHAR(2),
|
calculated_country_code VARCHAR(2),
|
||||||
|
|||||||
Reference in New Issue
Block a user