remove special casing for legacy tokenizer from BDD tests

This commit is contained in:
Sarah Hoffmann 2024-09-21 17:07:32 +02:00
parent 74c39267d9
commit d4f3eda314
13 changed files with 7 additions and 282 deletions

View File

@ -69,7 +69,6 @@ Feature: Search queries
| 0 | | 0 |
Then there are duplicates Then there are duplicates
@fail-legacy
Scenario: Search with bounded viewbox in right area Scenario: Search with bounded viewbox in right area
When sending json search query "post" with address When sending json search query "post" with address
| bounded | viewbox | | bounded | viewbox |

View File

@ -104,7 +104,6 @@ Feature: Parenting of objects
| N3 | W2 | | N3 | W2 |
| N4 | W1 | | N4 | W1 |
@fail-legacy
Scenario: addr:street tag parents to appropriately named street, locale names Scenario: addr:street tag parents to appropriately named street, locale names
Given the grid Given the grid
| 10 | | | | | 11 | | 10 | | | | | 11 |

View File

@ -195,7 +195,6 @@ Feature: Import of postcodes
| E45 2 | gb | 23 | 5 | | E45 2 | gb | 23 | 5 |
| Y45 | gb | 21 | 5 | | Y45 | gb | 21 | 5 |
@fail-legacy
Scenario: Postcodes outside all countries are not added to the postcode and word table Scenario: Postcodes outside all countries are not added to the postcode and word table
Given the places Given the places
| osm | class | type | addr+postcode | addr+housenumber | addr+place | geometry | | osm | class | type | addr+postcode | addr+housenumber | addr+place | geometry |

View File

@ -11,7 +11,6 @@ Feature: Creation of search terms
| object | name_vector | | object | name_vector |
| N1 | #New York, #Big Apple | | N1 | #New York, #Big Apple |
@fail-legacy
Scenario: Comma-separated names appear as a single full name Scenario: Comma-separated names appear as a single full name
Given the places Given the places
| osm | class | type | name+alt_name | | osm | class | type | name+alt_name |

View File

@ -27,7 +27,6 @@ Feature: Searching of house numbers
| N1 | | N1 |
@fail-legacy
Scenario Outline: Numeral housenumbers in any script are found Scenario Outline: Numeral housenumbers in any script are found
Given the places Given the places
| osm | class | type | housenr | geometry | | osm | class | type | housenr | geometry |
@ -84,7 +83,6 @@ Feature: Searching of house numbers
| 2, 4, 12 | | 2, 4, 12 |
@fail-legacy
Scenario Outline: Housenumber - letter combinations are found Scenario Outline: Housenumber - letter combinations are found
Given the places Given the places
| osm | class | type | housenr | geometry | | osm | class | type | housenr | geometry |
@ -150,7 +148,6 @@ Feature: Searching of house numbers
| 34/10 | | 34/10 |
@fail-legacy
Scenario Outline: a bis housenumber is found Scenario Outline: a bis housenumber is found
Given the places Given the places
| osm | class | type | housenr | geometry | | osm | class | type | housenr | geometry |
@ -184,7 +181,6 @@ Feature: Searching of house numbers
| 45 bis | | 45 bis |
@fail-legacy
Scenario Outline: a ter housenumber is found Scenario Outline: a ter housenumber is found
Given the places Given the places
| osm | class | type | housenr | geometry | | osm | class | type | housenr | geometry |
@ -218,7 +214,6 @@ Feature: Searching of house numbers
| 45 TER | | 45 TER |
@fail-legacy
Scenario Outline: a number - letter - number combination housenumber is found Scenario Outline: a number - letter - number combination housenumber is found
Given the places Given the places
| osm | class | type | housenr | geometry | | osm | class | type | housenr | geometry |
@ -252,7 +247,6 @@ Feature: Searching of house numbers
| 501h1 | | 501h1 |
@fail-legacy
Scenario Outline: Russian housenumbers are found Scenario Outline: Russian housenumbers are found
Given the places Given the places
| osm | class | type | housenr | geometry | | osm | class | type | housenr | geometry |

View File

@ -1,7 +1,6 @@
@DB @DB
Feature: Searches in Japan Feature: Searches in Japan
Test specifically for searches of Japanese addresses and in Japanese language. Test specifically for searches of Japanese addresses and in Japanese language.
@fail-legacy
Scenario: A block house-number is parented to the neighbourhood Scenario: A block house-number is parented to the neighbourhood
Given the grid with origin JP Given the grid with origin JP
| 1 | | | | 2 | | 1 | | | | 2 |

View File

@ -14,7 +14,6 @@ Feature: Querying fo postcode variants
| 0 | postcode | 399174, Singapore | | 0 | postcode | 399174, Singapore |
@fail-legacy
Scenario Outline: Postcodes in the Netherlands (mixed postcode with spaces) Scenario Outline: Postcodes in the Netherlands (mixed postcode with spaces)
Given the grid with origin NL Given the grid with origin NL
| 10 | | | | 11 | | 10 | | | | 11 |
@ -38,7 +37,6 @@ Feature: Querying fo postcode variants
| 3993 dx | | 3993 dx |
@fail-legacy
Scenario: Postcodes in Singapore (6-digit postcode) Scenario: Postcodes in Singapore (6-digit postcode)
Given the grid with origin SG Given the grid with origin SG
| 10 | | | | 11 | | 10 | | | | 11 |
@ -52,7 +50,6 @@ Feature: Querying fo postcode variants
| 0 | postcode | 399174, Singapore | | 0 | postcode | 399174, Singapore |
@fail-legacy
Scenario Outline: Postcodes in Andorra (with country code) Scenario Outline: Postcodes in Andorra (with country code)
Given the grid with origin AD Given the grid with origin AD
| 10 | | | | 11 | | 10 | | | | 11 |
@ -76,7 +73,6 @@ Feature: Querying fo postcode variants
| AD675 | | AD675 |
@fail-legacy
Scenario: Different postcodes with the same normalization can both be found Scenario: Different postcodes with the same normalization can both be found
Given the places Given the places
| osm | class | type | addr+postcode | addr+housenumber | geometry | | osm | class | type | addr+postcode | addr+housenumber | geometry |
@ -97,7 +93,6 @@ Feature: Querying fo postcode variants
| postcode | E4 7EA, United Kingdom | | postcode | E4 7EA, United Kingdom |
@fail-legacy
Scenario: Postcode areas are preferred over postcode points Scenario: Postcode areas are preferred over postcode points
Given the grid with origin DE Given the grid with origin DE
| 1 | 2 | | 1 | 2 |

View File

@ -77,7 +77,6 @@ Feature: Searching of simple objects
| W1 | | W1 |
@fail-legacy
Scenario Outline: Special cased american states will be found Scenario Outline: Special cased american states will be found
Given the grid Given the grid
| 1 | | 2 | | 1 | | 2 |

View File

@ -8,7 +8,6 @@ Feature: Country handling
| | 10 | | | | 10 | |
| 4 | | 3 | | 4 | | 3 |
@fail-legacy
Scenario: When country names are changed old ones are no longer searchable Scenario: When country names are changed old ones are no longer searchable
Given the places Given the places
| osm | class | type | admin | name+name:xy | country | geometry | | osm | class | type | admin | name+name:xy | country | geometry |
@ -27,7 +26,6 @@ Feature: Country handling
When sending search query "Wenig, Loudou" When sending search query "Wenig, Loudou"
Then exactly 0 results are returned Then exactly 0 results are returned
@fail-legacy
Scenario: When country names are deleted they are no longer searchable Scenario: When country names are deleted they are no longer searchable
Given the places Given the places
| osm | class | type | admin | name+name:xy | country | geometry | | osm | class | type | admin | name+name:xy | country | geometry |
@ -83,7 +81,6 @@ Feature: Country handling
| N10 | Wenig, Lilly | | N10 | Wenig, Lilly |
@fail-legacy
Scenario: When a localised name is deleted, the standard name takes over Scenario: When a localised name is deleted, the standard name takes over
Given the places Given the places
| osm | class | type | admin | name+name:de | country | geometry | | osm | class | type | admin | name+name:de | country | geometry |

View File

@ -60,9 +60,3 @@ def before_scenario(context, scenario):
def after_scenario(context, scenario): def after_scenario(context, scenario):
if 'DB' in context.tags: if 'DB' in context.tags:
context.nominatim.teardown_db(context) context.nominatim.teardown_db(context)
def before_tag(context, tag):
if tag == 'fail-legacy':
if context.config.userdata['TOKENIZER'] == 'legacy':
context.scenario.skip("Not implemented in legacy tokenizer")

View File

@ -34,7 +34,6 @@ class NominatimEnvironment:
self.api_test_file = config['API_TEST_FILE'] self.api_test_file = config['API_TEST_FILE']
self.tokenizer = config['TOKENIZER'] self.tokenizer = config['TOKENIZER']
self.import_style = config['STYLE'] self.import_style = config['STYLE']
self.server_module_path = config['SERVER_MODULE_PATH']
self.reuse_template = not config['REMOVE_TEMPLATE'] self.reuse_template = not config['REMOVE_TEMPLATE']
self.keep_scenario_db = config['KEEP_TEST_DB'] self.keep_scenario_db = config['KEEP_TEST_DB']
@ -48,9 +47,6 @@ class NominatimEnvironment:
raise RuntimeError(f"Unknown API engine '{config['API_ENGINE']}'") raise RuntimeError(f"Unknown API engine '{config['API_ENGINE']}'")
self.api_engine = getattr(self, f"create_api_request_func_{config['API_ENGINE']}")() self.api_engine = getattr(self, f"create_api_request_func_{config['API_ENGINE']}")()
if self.tokenizer == 'legacy' and self.server_module_path is None:
raise RuntimeError("You must set -DSERVER_MODULE_PATH when testing the legacy tokenizer.")
def connect_database(self, dbname): def connect_database(self, dbname):
""" Return a connection to the database with the given name. """ Return a connection to the database with the given name.
Uses configured host, user and port. Uses configured host, user and port.
@ -100,9 +96,6 @@ class NominatimEnvironment:
if self.import_style is not None: if self.import_style is not None:
self.test_env['NOMINATIM_IMPORT_STYLE'] = self.import_style self.test_env['NOMINATIM_IMPORT_STYLE'] = self.import_style
if self.server_module_path:
self.test_env['NOMINATIM_DATABASE_MODULE_PATH'] = self.server_module_path
if self.website_dir is not None: if self.website_dir is not None:
self.website_dir.cleanup() self.website_dir.cleanup()
@ -111,7 +104,6 @@ class NominatimEnvironment:
def get_test_config(self): def get_test_config(self):
cfg = Configuration(Path(self.website_dir.name), environ=self.test_env) cfg = Configuration(Path(self.website_dir.name), environ=self.test_env)
cfg.set_libdirs(module=self.server_module_path)
return cfg return cfg
def get_libpq_dsn(self): def get_libpq_dsn(self):
@ -190,12 +182,8 @@ class NominatimEnvironment:
self.run_nominatim('add-data', '--tiger-data', str(testdata / 'tiger')) self.run_nominatim('add-data', '--tiger-data', str(testdata / 'tiger'))
self.run_nominatim('freeze') self.run_nominatim('freeze')
if self.tokenizer == 'legacy': csv_path = str(testdata / 'full_en_phrases_test.csv')
phrase_file = str(testdata / 'specialphrases_testdb.sql') self.run_nominatim('special-phrases', '--import-from-csv', csv_path)
run_script(['psql', '-d', self.api_test_db, '-f', phrase_file])
else:
csv_path = str(testdata / 'full_en_phrases_test.csv')
self.run_nominatim('special-phrases', '--import-from-csv', csv_path)
except: except:
self.db_drop_database(self.api_test_db) self.db_drop_database(self.api_test_db)
raise raise
@ -278,7 +266,7 @@ class NominatimEnvironment:
if self.website_dir is not None: if self.website_dir is not None:
cmdline = list(cmdline) + ['--project-dir', self.website_dir.name] cmdline = list(cmdline) + ['--project-dir', self.website_dir.name]
cli.nominatim(module_dir=self.server_module_path, cli.nominatim(module_dir=None,
osm2pgsql_path=None, osm2pgsql_path=None,
cli_args=cmdline, cli_args=cmdline,
environ=self.test_env) environ=self.test_env)

View File

@ -28,9 +28,8 @@ def check_database_integrity(context):
assert cur.fetchone()[0] == 0, "Duplicates found in place_addressline" assert cur.fetchone()[0] == 0, "Duplicates found in place_addressline"
# word table must not have empty word_tokens # word table must not have empty word_tokens
if context.nominatim.tokenizer != 'legacy': cur.execute("SELECT count(*) FROM word WHERE word_token = ''")
cur.execute("SELECT count(*) FROM word WHERE word_token = ''") assert cur.fetchone()[0] == 0, "Empty word tokens found in word table"
assert cur.fetchone()[0] == 0, "Empty word tokens found in word table"
@ -324,13 +323,8 @@ def check_word_table_for_postcodes(context, exclude, postcodes):
plist.sort() plist.sort()
with context.db.cursor() as cur: with context.db.cursor() as cur:
if nctx.tokenizer != 'legacy': cur.execute("SELECT word FROM word WHERE type = 'P' and word = any(%s)",
cur.execute("SELECT word FROM word WHERE type = 'P' and word = any(%s)", (plist,))
(plist,))
else:
cur.execute("""SELECT word FROM word WHERE word = any(%s)
and class = 'place' and type = 'postcode'""",
(plist,))
found = [row['word'] for row in cur] found = [row['word'] for row in cur]
assert len(found) == len(set(found)), f"Duplicate rows for postcodes: {found}" assert len(found) == len(set(found)), f"Duplicate rows for postcodes: {found}"

View File

@ -1,231 +0,0 @@
CREATE OR REPLACE FUNCTION test_getorcreate_amenity(lookup_word TEXT, normalized_word TEXT,
lookup_class text, lookup_type text)
RETURNS INTEGER
AS $$
DECLARE
lookup_token TEXT;
return_word_id INTEGER;
BEGIN
lookup_token := ' '||trim(lookup_word);
SELECT min(word_id) FROM word
WHERE word_token = lookup_token and word = normalized_word
and class = lookup_class and type = lookup_type
INTO return_word_id;
IF return_word_id IS NULL THEN
return_word_id := nextval('seq_word');
INSERT INTO word VALUES (return_word_id, lookup_token, normalized_word,
lookup_class, lookup_type, null, 0);
END IF;
RETURN return_word_id;
END;
$$
LANGUAGE plpgsql;
CREATE OR REPLACE FUNCTION test_getorcreate_amenityoperator(lookup_word TEXT,
normalized_word TEXT,
lookup_class text,
lookup_type text,
op text)
RETURNS INTEGER
AS $$
DECLARE
lookup_token TEXT;
return_word_id INTEGER;
BEGIN
lookup_token := ' '||trim(lookup_word);
SELECT min(word_id) FROM word
WHERE word_token = lookup_token and word = normalized_word
and class = lookup_class and type = lookup_type and operator = op
INTO return_word_id;
IF return_word_id IS NULL THEN
return_word_id := nextval('seq_word');
INSERT INTO word VALUES (return_word_id, lookup_token, normalized_word,
lookup_class, lookup_type, null, 0, op);
END IF;
RETURN return_word_id;
END;
$$
LANGUAGE plpgsql;
SELECT test_getorcreate_amenity(make_standard_name('Aerodrome'), 'aerodrome', 'aeroway', 'aerodrome');
SELECT test_getorcreate_amenity(make_standard_name('Aerodromes'), 'aerodromes', 'aeroway', 'aerodrome');
SELECT test_getorcreate_amenityoperator(make_standard_name('Aerodrome in'), 'aerodrome in', 'aeroway', 'aerodrome', 'in');
SELECT test_getorcreate_amenityoperator(make_standard_name('Aerodromes in'), 'aerodromes in', 'aeroway', 'aerodrome', 'in');
SELECT test_getorcreate_amenityoperator(make_standard_name('Aerodrome near'), 'aerodrome near', 'aeroway', 'aerodrome', 'near');
SELECT test_getorcreate_amenityoperator(make_standard_name('Aerodromes near'), 'aerodromes near', 'aeroway', 'aerodrome', 'near');
SELECT test_getorcreate_amenity(make_standard_name('Airport'), 'airport', 'aeroway', 'aerodrome');
SELECT test_getorcreate_amenity(make_standard_name('Airports'), 'airports', 'aeroway', 'aerodrome');
SELECT test_getorcreate_amenityoperator(make_standard_name('Airport in'), 'airport in', 'aeroway', 'aerodrome', 'in');
SELECT test_getorcreate_amenityoperator(make_standard_name('Airports in'), 'airports in', 'aeroway', 'aerodrome', 'in');
SELECT test_getorcreate_amenityoperator(make_standard_name('Airport near'), 'airport near', 'aeroway', 'aerodrome', 'near');
SELECT test_getorcreate_amenityoperator(make_standard_name('Airports near'), 'airports near', 'aeroway', 'aerodrome', 'near');
SELECT test_getorcreate_amenity(make_standard_name('Bar'), 'bar', 'amenity', 'bar');
SELECT test_getorcreate_amenity(make_standard_name('Bars'), 'bars', 'amenity', 'bar');
SELECT test_getorcreate_amenityoperator(make_standard_name('Bar in'), 'bar in', 'amenity', 'bar', 'in');
SELECT test_getorcreate_amenityoperator(make_standard_name('Bars in'), 'bars in', 'amenity', 'bar', 'in');
SELECT test_getorcreate_amenityoperator(make_standard_name('Bar near'), 'bar near', 'amenity', 'bar', 'near');
SELECT test_getorcreate_amenityoperator(make_standard_name('Bars near'), 'bars near', 'amenity', 'bar', 'near');
SELECT test_getorcreate_amenity(make_standard_name('Bar'), 'bar', 'amenity', 'pub');
SELECT test_getorcreate_amenity(make_standard_name('Bars'), 'bars', 'amenity', 'pub');
SELECT test_getorcreate_amenityoperator(make_standard_name('Bar in'), 'bar in', 'amenity', 'pub', 'in');
SELECT test_getorcreate_amenityoperator(make_standard_name('Bars in'), 'bars in', 'amenity', 'pub', 'in');
SELECT test_getorcreate_amenityoperator(make_standard_name('Bar near'), 'bar near', 'amenity', 'pub', 'near');
SELECT test_getorcreate_amenityoperator(make_standard_name('Bars near'), 'bars near', 'amenity', 'pub', 'near');
SELECT test_getorcreate_amenity(make_standard_name('Food'), 'food', 'amenity', 'restaurant');
SELECT test_getorcreate_amenity(make_standard_name('Food'), 'food', 'amenity', 'restaurant');
SELECT test_getorcreate_amenityoperator(make_standard_name('Food in'), 'food in', 'amenity', 'restaurant', 'in');
SELECT test_getorcreate_amenityoperator(make_standard_name('Food in'), 'food in', 'amenity', 'restaurant', 'in');
SELECT test_getorcreate_amenityoperator(make_standard_name('Food near'), 'food near', 'amenity', 'restaurant', 'near');
SELECT test_getorcreate_amenityoperator(make_standard_name('Food near'), 'food near', 'amenity', 'restaurant', 'near');
SELECT test_getorcreate_amenity(make_standard_name('Pub'), 'pub', 'amenity', 'bar');
SELECT test_getorcreate_amenity(make_standard_name('Pubs'), 'pubs', 'amenity', 'bar');
SELECT test_getorcreate_amenityoperator(make_standard_name('Pub in'), 'pub in', 'amenity', 'bar', 'in');
SELECT test_getorcreate_amenityoperator(make_standard_name('Pubs in'), 'pubs in', 'amenity', 'bar', 'in');
SELECT test_getorcreate_amenityoperator(make_standard_name('Pub near'), 'pub near', 'amenity', 'bar', 'near');
SELECT test_getorcreate_amenityoperator(make_standard_name('Pubs near'), 'pubs near', 'amenity', 'bar', 'near');
SELECT test_getorcreate_amenity(make_standard_name('Pub'), 'pub', 'amenity', 'pub');
SELECT test_getorcreate_amenity(make_standard_name('Pubs'), 'pubs', 'amenity', 'pub');
SELECT test_getorcreate_amenityoperator(make_standard_name('Pub in'), 'pub in', 'amenity', 'pub', 'in');
SELECT test_getorcreate_amenityoperator(make_standard_name('Pubs in'), 'pubs in', 'amenity', 'pub', 'in');
SELECT test_getorcreate_amenityoperator(make_standard_name('Pub near'), 'pub near', 'amenity', 'pub', 'near');
SELECT test_getorcreate_amenityoperator(make_standard_name('Pubs near'), 'pubs near', 'amenity', 'pub', 'near');
SELECT test_getorcreate_amenity(make_standard_name('Restaurant'), 'restaurant', 'amenity', 'restaurant');
SELECT test_getorcreate_amenity(make_standard_name('Restaurants'), 'restaurants', 'amenity', 'restaurant');
SELECT test_getorcreate_amenityoperator(make_standard_name('Restaurant in'), 'restaurant in', 'amenity', 'restaurant', 'in');
SELECT test_getorcreate_amenityoperator(make_standard_name('Restaurants in'), 'restaurants in', 'amenity', 'restaurant', 'in');
SELECT test_getorcreate_amenityoperator(make_standard_name('Restaurant near'), 'restaurant near', 'amenity', 'restaurant', 'near');
SELECT test_getorcreate_amenityoperator(make_standard_name('Restaurants near'), 'restaurants near', 'amenity', 'restaurant', 'near');
SELECT test_getorcreate_amenity(make_standard_name('Mural'), 'mural', 'artwork_type', 'mural');
SELECT test_getorcreate_amenity(make_standard_name('Murals'), 'murals', 'artwork_type', 'mural');
SELECT test_getorcreate_amenityoperator(make_standard_name('Mural in'), 'mural in', 'artwork_type', 'mural', 'in');
SELECT test_getorcreate_amenityoperator(make_standard_name('Murals in'), 'murals in', 'artwork_type', 'mural', 'in');
SELECT test_getorcreate_amenityoperator(make_standard_name('Mural near'), 'mural near', 'artwork_type', 'mural', 'near');
SELECT test_getorcreate_amenityoperator(make_standard_name('Murals near'), 'murals near', 'artwork_type', 'mural', 'near');
SELECT test_getorcreate_amenity(make_standard_name('Sculpture'), 'sculpture', 'artwork_type', 'sculpture');
SELECT test_getorcreate_amenity(make_standard_name('Sculptures'), 'sculptures', 'artwork_type', 'sculpture');
SELECT test_getorcreate_amenityoperator(make_standard_name('Sculpture in'), 'sculpture in', 'artwork_type', 'sculpture', 'in');
SELECT test_getorcreate_amenityoperator(make_standard_name('Sculptures in'), 'sculptures in', 'artwork_type', 'sculpture', 'in');
SELECT test_getorcreate_amenityoperator(make_standard_name('Sculpture near'), 'sculpture near', 'artwork_type', 'sculpture', 'near');
SELECT test_getorcreate_amenityoperator(make_standard_name('Sculptures near'), 'sculptures near', 'artwork_type', 'sculpture', 'near');
SELECT test_getorcreate_amenity(make_standard_name('Statue'), 'statue', 'artwork_type', 'statue');
SELECT test_getorcreate_amenity(make_standard_name('Statues'), 'statues', 'artwork_type', 'statue');
SELECT test_getorcreate_amenityoperator(make_standard_name('Statue in'), 'statue in', 'artwork_type', 'statue', 'in');
SELECT test_getorcreate_amenityoperator(make_standard_name('Statues in'), 'statues in', 'artwork_type', 'statue', 'in');
SELECT test_getorcreate_amenityoperator(make_standard_name('Statue near'), 'statue near', 'artwork_type', 'statue', 'near');
SELECT test_getorcreate_amenityoperator(make_standard_name('Statues near'), 'statues near', 'artwork_type', 'statue', 'near');
SELECT test_getorcreate_amenity(make_standard_name('ATM'), 'atm', 'atm', 'yes');
SELECT test_getorcreate_amenity(make_standard_name('ATMs'), 'atms', 'atm', 'yes');
SELECT test_getorcreate_amenityoperator(make_standard_name('ATM in'), 'atm in', 'atm', 'yes', 'in');
SELECT test_getorcreate_amenityoperator(make_standard_name('ATMs in'), 'atms in', 'atm', 'yes', 'in');
SELECT test_getorcreate_amenityoperator(make_standard_name('ATM near'), 'atm near', 'atm', 'yes', 'near');
SELECT test_getorcreate_amenityoperator(make_standard_name('ATMs near'), 'atms near', 'atm', 'yes', 'near');
SELECT test_getorcreate_amenity(make_standard_name('National Park'), 'national park', 'boundary', 'national_park');
SELECT test_getorcreate_amenity(make_standard_name('National Parks'), 'national parks', 'boundary', 'national_park');
SELECT test_getorcreate_amenityoperator(make_standard_name('National Park in'), 'national park in', 'boundary', 'national_park', 'in');
SELECT test_getorcreate_amenityoperator(make_standard_name('National Parks in'), 'national parks in', 'boundary', 'national_park', 'in');
SELECT test_getorcreate_amenityoperator(make_standard_name('National Park near'), 'national park near', 'boundary', 'national_park', 'near');
SELECT test_getorcreate_amenityoperator(make_standard_name('National Parks near'), 'national parks near', 'boundary', 'national_park', 'near');
SELECT test_getorcreate_amenity(make_standard_name('Changing table'), 'changing table', 'changing_table', 'yes');
SELECT test_getorcreate_amenity(make_standard_name('Changing tables'), 'changing tables', 'changing_table', 'yes');
SELECT test_getorcreate_amenityoperator(make_standard_name('Changing table in'), 'changing table in', 'changing_table', 'yes', 'in');
SELECT test_getorcreate_amenityoperator(make_standard_name('Changing tables in'), 'changing tables in', 'changing_table', 'yes', 'in');
SELECT test_getorcreate_amenityoperator(make_standard_name('Changing table near'), 'changing table near', 'changing_table', 'yes', 'near');
SELECT test_getorcreate_amenityoperator(make_standard_name('Changing tables near'), 'changing tables near', 'changing_table', 'yes', 'near');
SELECT test_getorcreate_amenity(make_standard_name('Roundabout'), 'roundabout', 'junction', 'roundabout');
SELECT test_getorcreate_amenity(make_standard_name('Roundabouts'), 'roundabouts', 'junction', 'roundabout');
SELECT test_getorcreate_amenityoperator(make_standard_name('Roundabout in'), 'roundabout in', 'junction', 'roundabout', 'in');
SELECT test_getorcreate_amenityoperator(make_standard_name('Roundabouts in'), 'roundabouts in', 'junction', 'roundabout', 'in');
SELECT test_getorcreate_amenityoperator(make_standard_name('Roundabout near'), 'roundabout near', 'junction', 'roundabout', 'near');
SELECT test_getorcreate_amenityoperator(make_standard_name('Roundabouts near'), 'roundabouts near', 'junction', 'roundabout', 'near');
SELECT test_getorcreate_amenity(make_standard_name('Plaque'), 'plaque', 'memorial', 'plaque');
SELECT test_getorcreate_amenity(make_standard_name('Plaques'), 'plaques', 'memorial', 'plaque');
SELECT test_getorcreate_amenityoperator(make_standard_name('Plaque in'), 'plaque in', 'memorial', 'plaque', 'in');
SELECT test_getorcreate_amenityoperator(make_standard_name('Plaques in'), 'plaques in', 'memorial', 'plaque', 'in');
SELECT test_getorcreate_amenityoperator(make_standard_name('Plaque near'), 'plaque near', 'memorial', 'plaque', 'near');
SELECT test_getorcreate_amenityoperator(make_standard_name('Plaques near'), 'plaques near', 'memorial', 'plaque', 'near');
SELECT test_getorcreate_amenity(make_standard_name('Statue'), 'statue', 'memorial', 'statue');
SELECT test_getorcreate_amenity(make_standard_name('Statues'), 'statues', 'memorial', 'statue');
SELECT test_getorcreate_amenityoperator(make_standard_name('Statue in'), 'statue in', 'memorial', 'statue', 'in');
SELECT test_getorcreate_amenityoperator(make_standard_name('Statues in'), 'statues in', 'memorial', 'statue', 'in');
SELECT test_getorcreate_amenityoperator(make_standard_name('Statue near'), 'statue near', 'memorial', 'statue', 'near');
SELECT test_getorcreate_amenityoperator(make_standard_name('Statues near'), 'statues near', 'memorial', 'statue', 'near');
SELECT test_getorcreate_amenity(make_standard_name('Stolperstein'), 'stolperstein', 'memorial', 'stolperstein');
SELECT test_getorcreate_amenity(make_standard_name('Stolpersteins'), 'stolpersteins', 'memorial', 'stolperstein');
SELECT test_getorcreate_amenity(make_standard_name('Stolpersteine'), 'stolpersteine', 'memorial', 'stolperstein');
SELECT test_getorcreate_amenityoperator(make_standard_name('Stolperstein in'), 'stolperstein in', 'memorial', 'stolperstein', 'in');
SELECT test_getorcreate_amenityoperator(make_standard_name('Stolpersteins in'), 'stolpersteins in', 'memorial', 'stolperstein', 'in');
SELECT test_getorcreate_amenityoperator(make_standard_name('Stolpersteine in'), 'stolpersteine in', 'memorial', 'stolperstein', 'in');
SELECT test_getorcreate_amenityoperator(make_standard_name('Stolperstein near'), 'stolperstein near', 'memorial', 'stolperstein', 'near');
SELECT test_getorcreate_amenityoperator(make_standard_name('Stolpersteins near'), 'stolpersteins near', 'memorial', 'stolperstein', 'near');
SELECT test_getorcreate_amenityoperator(make_standard_name('Stolpersteine near'), 'stolpersteine near', 'memorial', 'stolperstein', 'near');
SELECT test_getorcreate_amenity(make_standard_name('War Memorial'), 'war memorial', 'memorial', 'war_memorial');
SELECT test_getorcreate_amenity(make_standard_name('War Memorials'), 'war memorials', 'memorial', 'war_memorial');
SELECT test_getorcreate_amenityoperator(make_standard_name('War Memorial in'), 'war memorial in', 'memorial', 'war_memorial', 'in');
SELECT test_getorcreate_amenityoperator(make_standard_name('War Memorials in'), 'war memorials in', 'memorial', 'war_memorial', 'in');
SELECT test_getorcreate_amenityoperator(make_standard_name('War Memorial near'), 'war memorial near', 'memorial', 'war_memorial', 'near');
SELECT test_getorcreate_amenityoperator(make_standard_name('War Memorials near'), 'war memorials near', 'memorial', 'war_memorial', 'near');
CREATE INDEX idx_placex_classtype ON placex (class, type);CREATE TABLE place_classtype_aeroway_aerodrome AS SELECT place_id AS place_id,st_centroid(geometry) AS centroid FROM placex WHERE class = 'aeroway' AND type = 'aerodrome';
CREATE INDEX idx_place_classtype_aeroway_aerodrome_centroid ON place_classtype_aeroway_aerodrome USING GIST (centroid);
CREATE INDEX idx_place_classtype_aeroway_aerodrome_place_id ON place_classtype_aeroway_aerodrome USING btree(place_id);
GRANT SELECT ON place_classtype_aeroway_aerodrome TO "www-data";
CREATE TABLE place_classtype_amenity_bar AS SELECT place_id AS place_id,st_centroid(geometry) AS centroid FROM placex WHERE class = 'amenity' AND type = 'bar';
CREATE INDEX idx_place_classtype_amenity_bar_centroid ON place_classtype_amenity_bar USING GIST (centroid);
CREATE INDEX idx_place_classtype_amenity_bar_place_id ON place_classtype_amenity_bar USING btree(place_id);
GRANT SELECT ON place_classtype_amenity_bar TO "www-data";
CREATE TABLE place_classtype_amenity_pub AS SELECT place_id AS place_id,st_centroid(geometry) AS centroid FROM placex WHERE class = 'amenity' AND type = 'pub';
CREATE INDEX idx_place_classtype_amenity_pub_centroid ON place_classtype_amenity_pub USING GIST (centroid);
CREATE INDEX idx_place_classtype_amenity_pub_place_id ON place_classtype_amenity_pub USING btree(place_id);
GRANT SELECT ON place_classtype_amenity_pub TO "www-data";
CREATE TABLE place_classtype_amenity_restaurant AS SELECT place_id AS place_id,st_centroid(geometry) AS centroid FROM placex WHERE class = 'amenity' AND type = 'restaurant';
CREATE INDEX idx_place_classtype_amenity_restaurant_centroid ON place_classtype_amenity_restaurant USING GIST (centroid);
CREATE INDEX idx_place_classtype_amenity_restaurant_place_id ON place_classtype_amenity_restaurant USING btree(place_id);
GRANT SELECT ON place_classtype_amenity_restaurant TO "www-data";
CREATE TABLE place_classtype_artwork_type_mural AS SELECT place_id AS place_id,st_centroid(geometry) AS centroid FROM placex WHERE class = 'artwork_type' AND type = 'mural';
CREATE INDEX idx_place_classtype_artwork_type_mural_centroid ON place_classtype_artwork_type_mural USING GIST (centroid);
CREATE INDEX idx_place_classtype_artwork_type_mural_place_id ON place_classtype_artwork_type_mural USING btree(place_id);
GRANT SELECT ON place_classtype_artwork_type_mural TO "www-data";
CREATE TABLE place_classtype_artwork_type_sculpture AS SELECT place_id AS place_id,st_centroid(geometry) AS centroid FROM placex WHERE class = 'artwork_type' AND type = 'sculpture';
CREATE INDEX idx_place_classtype_artwork_type_sculpture_centroid ON place_classtype_artwork_type_sculpture USING GIST (centroid);
CREATE INDEX idx_place_classtype_artwork_type_sculpture_place_id ON place_classtype_artwork_type_sculpture USING btree(place_id);
GRANT SELECT ON place_classtype_artwork_type_sculpture TO "www-data";
CREATE TABLE place_classtype_artwork_type_statue AS SELECT place_id AS place_id,st_centroid(geometry) AS centroid FROM placex WHERE class = 'artwork_type' AND type = 'statue';
CREATE INDEX idx_place_classtype_artwork_type_statue_centroid ON place_classtype_artwork_type_statue USING GIST (centroid);
CREATE INDEX idx_place_classtype_artwork_type_statue_place_id ON place_classtype_artwork_type_statue USING btree(place_id);
GRANT SELECT ON place_classtype_artwork_type_statue TO "www-data";
CREATE TABLE place_classtype_atm_yes AS SELECT place_id AS place_id,st_centroid(geometry) AS centroid FROM placex WHERE class = 'atm' AND type = 'yes';
CREATE INDEX idx_place_classtype_atm_yes_centroid ON place_classtype_atm_yes USING GIST (centroid);
CREATE INDEX idx_place_classtype_atm_yes_place_id ON place_classtype_atm_yes USING btree(place_id);
GRANT SELECT ON place_classtype_atm_yes TO "www-data";
CREATE TABLE place_classtype_boundary_national_park AS SELECT place_id AS place_id,st_centroid(geometry) AS centroid FROM placex WHERE class = 'boundary' AND type = 'national_park';
CREATE INDEX idx_place_classtype_boundary_national_park_centroid ON place_classtype_boundary_national_park USING GIST (centroid);
CREATE INDEX idx_place_classtype_boundary_national_park_place_id ON place_classtype_boundary_national_park USING btree(place_id);
GRANT SELECT ON place_classtype_boundary_national_park TO "www-data";
CREATE TABLE place_classtype_changing_table_yes AS SELECT place_id AS place_id,st_centroid(geometry) AS centroid FROM placex WHERE class = 'changing_table' AND type = 'yes';
CREATE INDEX idx_place_classtype_changing_table_yes_centroid ON place_classtype_changing_table_yes USING GIST (centroid);
CREATE INDEX idx_place_classtype_changing_table_yes_place_id ON place_classtype_changing_table_yes USING btree(place_id);
GRANT SELECT ON place_classtype_changing_table_yes TO "www-data";
CREATE TABLE place_classtype_junction_roundabout AS SELECT place_id AS place_id,st_centroid(geometry) AS centroid FROM placex WHERE class = 'junction' AND type = 'roundabout';
CREATE INDEX idx_place_classtype_junction_roundabout_centroid ON place_classtype_junction_roundabout USING GIST (centroid);
CREATE INDEX idx_place_classtype_junction_roundabout_place_id ON place_classtype_junction_roundabout USING btree(place_id);
GRANT SELECT ON place_classtype_junction_roundabout TO "www-data";
CREATE TABLE place_classtype_memorial_plaque AS SELECT place_id AS place_id,st_centroid(geometry) AS centroid FROM placex WHERE class = 'memorial' AND type = 'plaque';
CREATE INDEX idx_place_classtype_memorial_plaque_centroid ON place_classtype_memorial_plaque USING GIST (centroid);
CREATE INDEX idx_place_classtype_memorial_plaque_place_id ON place_classtype_memorial_plaque USING btree(place_id);
GRANT SELECT ON place_classtype_memorial_plaque TO "www-data";
CREATE TABLE place_classtype_memorial_statue AS SELECT place_id AS place_id,st_centroid(geometry) AS centroid FROM placex WHERE class = 'memorial' AND type = 'statue';
CREATE INDEX idx_place_classtype_memorial_statue_centroid ON place_classtype_memorial_statue USING GIST (centroid);
CREATE INDEX idx_place_classtype_memorial_statue_place_id ON place_classtype_memorial_statue USING btree(place_id);
GRANT SELECT ON place_classtype_memorial_statue TO "www-data";
CREATE TABLE place_classtype_memorial_stolperstein AS SELECT place_id AS place_id,st_centroid(geometry) AS centroid FROM placex WHERE class = 'memorial' AND type = 'stolperstein';
CREATE INDEX idx_place_classtype_memorial_stolperstein_centroid ON place_classtype_memorial_stolperstein USING GIST (centroid);
CREATE INDEX idx_place_classtype_memorial_stolperstein_place_id ON place_classtype_memorial_stolperstein USING btree(place_id);
GRANT SELECT ON place_classtype_memorial_stolperstein TO "www-data";
CREATE TABLE place_classtype_memorial_war_memorial AS SELECT place_id AS place_id,st_centroid(geometry) AS centroid FROM placex WHERE class = 'memorial' AND type = 'war_memorial';
CREATE INDEX idx_place_classtype_memorial_war_memorial_centroid ON place_classtype_memorial_war_memorial USING GIST (centroid);
CREATE INDEX idx_place_classtype_memorial_war_memorial_place_id ON place_classtype_memorial_war_memorial USING btree(place_id);
GRANT SELECT ON place_classtype_memorial_war_memorial TO "www-data";
DROP INDEX idx_placex_classtype;
DROP FUNCTION test_getorcreate_amenity;
DROP FUNCTION test_getorcreate_amenityoperator;