mirror of
https://github.com/osm-search/Nominatim.git
synced 2026-02-26 11:08:13 +00:00
make sure that addr:* tags can always be searched for
Always add contents of addr:* tags into address part of the search table, even when there is no corresponding other name. This keeps search tolerant to the kind of tagging where parts show up in the address that have no corresponding object in the database or where it is only an unaddressable object.
This commit is contained in:
@@ -207,16 +207,22 @@ CREATE OR REPLACE FUNCTION addr_ids_from_name(lookup_word TEXT)
|
|||||||
AS $$
|
AS $$
|
||||||
DECLARE
|
DECLARE
|
||||||
lookup_token TEXT;
|
lookup_token TEXT;
|
||||||
|
id INTEGER;
|
||||||
return_word_id INTEGER[];
|
return_word_id INTEGER[];
|
||||||
BEGIN
|
BEGIN
|
||||||
lookup_token := make_standard_name(lookup_word);
|
lookup_token := make_standard_name(lookup_word);
|
||||||
SELECT array_agg(word_id) FROM word
|
SELECT array_agg(word_id) FROM word
|
||||||
WHERE word_token = lookup_token and class is null and type is null
|
WHERE word_token = lookup_token and class is null and type is null
|
||||||
INTO return_word_id;
|
INTO return_word_id;
|
||||||
|
IF return_word_id IS NULL THEN
|
||||||
|
id := nextval('seq_word');
|
||||||
|
INSERT INTO word VALUES (id, lookup_token, null, null, null, null, 0);
|
||||||
|
return_word_id = ARRAY[id];
|
||||||
|
END IF;
|
||||||
RETURN return_word_id;
|
RETURN return_word_id;
|
||||||
END;
|
END;
|
||||||
$$
|
$$
|
||||||
LANGUAGE plpgsql STABLE;
|
LANGUAGE plpgsql;
|
||||||
|
|
||||||
|
|
||||||
-- Normalize a string and look up its name ids (full words).
|
-- Normalize a string and look up its name ids (full words).
|
||||||
|
|||||||
@@ -39,13 +39,13 @@ Feature: Creation of search terms
|
|||||||
| object | nameaddress_vector |
|
| object | nameaddress_vector |
|
||||||
| W1 | bonn, new york, smalltown |
|
| W1 | bonn, new york, smalltown |
|
||||||
|
|
||||||
Scenario: A known addr:* tag is not added if the name is unknown
|
Scenario: A known addr:* tag is added even if the name is unknown
|
||||||
Given the scene roads-with-pois
|
Given the scene roads-with-pois
|
||||||
And the places
|
And the places
|
||||||
| osm | class | type | name | addr+city | geometry |
|
| osm | class | type | name | addr+city | geometry |
|
||||||
| W1 | highway | residential | Road | Nandu | :w-north |
|
| W1 | highway | residential | Road | Nandu | :w-north |
|
||||||
When importing
|
When importing
|
||||||
Then search_name contains not
|
Then search_name contains
|
||||||
| object | nameaddress_vector |
|
| object | nameaddress_vector |
|
||||||
| W1 | nandu |
|
| W1 | nandu |
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user