From 070e68be0da20feab58daacba69a612c59881482 Mon Sep 17 00:00:00 2001 From: Sarah Hoffmann Date: Wed, 4 Oct 2023 14:41:19 +0200 Subject: [PATCH] make sure the place name always comes first in output Also deleted some now unused code. --- nominatim/api/results.py | 20 +------------------- test/bdd/api/search/queries.feature | 8 ++++++++ 2 files changed, 9 insertions(+), 19 deletions(-) diff --git a/nominatim/api/results.py b/nominatim/api/results.py index b504fefa63..b5e9a41794 100644 --- a/nominatim/api/results.py +++ b/nominatim/api/results.py @@ -490,24 +490,6 @@ def _result_row_to_address_row(row: SaRow, isaddress: Optional[bool] = None) -> distance=row.distance) -def _get_housenumber_details(results: List[BaseResultT]) -> Tuple[List[int], List[int]]: - places = [] - hnrs = [] - for result in results: - if result.place_id: - housenumber = -1 - if result.source_table in (SourceTable.TIGER, SourceTable.OSMLINE): - if result.housenumber is not None: - housenumber = int(result.housenumber) - elif result.extratags is not None and 'startnumber' in result.extratags: - # details requests do not come with a specific house number - housenumber = int(result.extratags['startnumber']) - places.append(result.place_id) - hnrs.append(housenumber) - - return places, hnrs - - def _get_address_lookup_id(result: BaseResultT) -> int: assert result.place_id if result.source_table != SourceTable.PLACEX or result.rank_search > 27: @@ -568,7 +550,7 @@ def _setup_address_details(result: BaseResultT) -> None: extratags=result.extratags or {}, admin_level=result.admin_level, fromarea=True, isaddress=True, - rank_address=result.rank_address, distance=0.0)) + rank_address=result.rank_address or 100, distance=0.0)) if result.source_table == SourceTable.PLACEX and result.address: housenumber = result.address.get('housenumber')\ or result.address.get('streetnumber')\ diff --git a/test/bdd/api/search/queries.feature b/test/bdd/api/search/queries.feature index f0474460db..84cbefe3dc 100644 --- a/test/bdd/api/search/queries.feature +++ b/test/bdd/api/search/queries.feature @@ -2,6 +2,14 @@ Feature: Search queries Generic search result correctness + Scenario: Search for natural object + When sending json search query "Samina" + | accept-language | + | en | + Then results contain + | class | type | display_name | + | waterway | river | Samina, Austria | + Scenario: House number search for non-street address When sending json search query "6 Silum, Liechtenstein" with address | accept-language |