X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/b24ef60b33da99938d864b3ff1b9399282dd253a..c0e4a74c713f2c6b9538cbbaf0d32d5c558d0dac:/tests/steps/db_setup.py?ds=sidebyside diff --git a/tests/steps/db_setup.py b/tests/steps/db_setup.py index 8041c6cc..727e6105 100644 --- a/tests/steps/db_setup.py +++ b/tests/steps/db_setup.py @@ -23,6 +23,7 @@ import os import subprocess import random import base64 +import sys psycopg2.extensions.register_type(psycopg2.extensions.UNICODE) @@ -143,8 +144,8 @@ def import_set_scene(step, scene): @step(u'the (named )?place (node|way|area)s') def import_place_table_nodes(step, named, osmtype): - """Insert a list of nodes into the placex table. - Expects a table where columns are named in the same way as placex. + """Insert a list of nodes into the place table. + Expects a table where columns are named in the same way as place. """ cur = world.conn.cursor() cur.execute('ALTER TABLE place DISABLE TRIGGER place_before_insert') @@ -184,9 +185,9 @@ def import_fill_planet_osm_rels(step): if not members: members = None - cur.execute("""INSERT INTO planet_osm_rels - (id, way_off, rel_off, parts, members, tags, pending) - VALUES (%s, %s, %s, %s, %s, %s, false)""", + cur.execute("""INSERT INTO planet_osm_rels + (id, way_off, rel_off, parts, members, tags) + VALUES (%s, %s, %s, %s, %s, %s)""", (line['id'], len(parts['n']), len(parts['n']) + len(parts['w']), parts['n'] + parts['w'] + parts['r'], members, tags)) world.conn.commit() @@ -202,9 +203,8 @@ def import_fill_planet_osm_ways(step): tags = None nodes = [int(x.strip()) for x in line['nodes'].split(',')] - cur.execute("""INSERT INTO planet_osm_ways - (id, nodes, tags, pending) - VALUES (%s, %s, %s, false)""", + cur.execute("""INSERT INTO planet_osm_ways (id, nodes, tags) + VALUES (%s, %s, %s)""", (line['id'], nodes, tags)) world.conn.commit() @@ -215,18 +215,19 @@ def import_database(step): """ Runs the actual indexing. """ world.run_nominatim_script('setup', 'create-functions', 'create-partition-functions') cur = world.conn.cursor() + #world.db_dump_table('place') cur.execute("""insert into placex (osm_type, osm_id, class, type, name, admin_level, housenumber, street, addr_place, isin, postcode, country_code, extratags, - geometry) select * from place""") + geometry) select * from place where not (class='place' and type='houses' and osm_type='W')""") + cur.execute("""select insert_osmline (osm_id, housenumber, street, addr_place, postcode, country_code, geometry) from place where class='place' and type='houses' and osm_type='W'""") world.conn.commit() world.run_nominatim_script('setup', 'index', 'index-noanalyse') #world.db_dump_table('placex') - + #world.db_dump_table('location_property_osmline') @step(u'updating place (node|way|area)s') def update_place_table_nodes(step, osmtype): - """ Replace a geometry in place by reinsertion and reindex database. - """ + """ Replace a geometry in place by reinsertion and reindex database.""" world.run_nominatim_script('setup', 'create-functions', 'create-partition-functions', 'enable-diff-updates') if osmtype == 'node': _insert_place_table_nodes(step.hashes, False) @@ -271,6 +272,7 @@ def query_cmd(step, query, with_dups): (outp, err) = proc.communicate() assert (proc.returncode == 0), "query.php failed with message: %s" % err world.page = outp - world.response_format = 'json' + world.response_format = 'json' + world.request_type = 'search' world.returncode = 200