mirror of
https://github.com/osm-search/Nominatim.git
synced 2026-03-09 19:44:07 +00:00
enforce presence of importance value in placex
This commit is contained in:
@@ -731,6 +731,10 @@ BEGIN
|
||||
|
||||
END IF;
|
||||
|
||||
IF NEW.importance IS NULL THEN
|
||||
NEW.importance := 0.40001 - (NEW.rank_search::float / 75);
|
||||
END IF;
|
||||
|
||||
{% if debug %}RAISE WARNING 'placex_insert:END: % % % %',NEW.osm_type,NEW.osm_id,NEW.class,NEW.type;{% endif %}
|
||||
|
||||
{% if not disable_diff_updates %}
|
||||
@@ -1076,10 +1080,8 @@ BEGIN
|
||||
{% if debug %}RAISE WARNING 'Waterway processed';{% endif %}
|
||||
END IF;
|
||||
|
||||
NEW.importance := null;
|
||||
SELECT wikipedia, importance
|
||||
FROM compute_importance(NEW.extratags, NEW.country_code, NEW.rank_search, NEW.centroid)
|
||||
INTO NEW.wikipedia,NEW.importance;
|
||||
SELECT wikipedia, importance INTO NEW.wikipedia, NEW.importance
|
||||
FROM compute_importance(NEW.extratags, NEW.country_code, NEW.rank_search, NEW.centroid);
|
||||
|
||||
{% if debug %}RAISE WARNING 'Importance computed from wikipedia: %', NEW.importance;{% endif %}
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ CREATE TABLE placex (
|
||||
place_id BIGINT NOT NULL,
|
||||
parent_place_id BIGINT,
|
||||
linked_place_id BIGINT,
|
||||
importance FLOAT,
|
||||
importance FLOAT NOT NULL,
|
||||
indexed_date TIMESTAMP,
|
||||
geometry_sector INTEGER NOT NULL,
|
||||
rank_address SMALLINT NOT NULL,
|
||||
|
||||
@@ -293,13 +293,14 @@ def placex_row(placex_table, temp_db_cursor):
|
||||
def _add(osm_type='N', osm_id=None, cls='amenity', typ='cafe', names=None,
|
||||
admin_level=None, address=None, extratags=None, geom='POINT(10 4)',
|
||||
country=None, housenumber=None, rank_search=30, rank_address=30,
|
||||
centroid='POINT(10 4)', indexed_status=0, indexed_date=None):
|
||||
centroid='POINT(10 4)', indexed_status=0, indexed_date=None,
|
||||
importance=0.00001):
|
||||
args = {'place_id': pysql.SQL("nextval('seq_place')"),
|
||||
'osm_type': osm_type, 'osm_id': osm_id or next(idseq),
|
||||
'class': cls, 'type': typ, 'name': names, 'admin_level': admin_level,
|
||||
'address': address, 'housenumber': housenumber,
|
||||
'rank_search': rank_search, 'rank_address': rank_address,
|
||||
'extratags': extratags,
|
||||
'extratags': extratags, 'importance': importance,
|
||||
'centroid': _with_srid(centroid), 'geometry': _with_srid(geom),
|
||||
'country_code': country,
|
||||
'indexed_status': indexed_status, 'indexed_date': indexed_date,
|
||||
|
||||
@@ -176,6 +176,7 @@ async def test_load_data(dsn, place_row, place_interpolation_row, placex_table,
|
||||
BEGIN
|
||||
NEW.place_id := nextval('seq_place');
|
||||
NEW.indexed_status := 1;
|
||||
NEW.importance := 0.00001;
|
||||
NEW.centroid := ST_Centroid(NEW.geometry);
|
||||
NEW.partition := 0;
|
||||
NEW.geometry_sector := 2424;
|
||||
|
||||
Reference in New Issue
Block a user