Skip to content

Commit

Permalink
make sure the place name always comes first in output
Browse files Browse the repository at this point in the history
Also deleted some now unused code.
  • Loading branch information
lonvia committed Oct 5, 2023
1 parent 54cb9a3 commit 5011fde
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 19 deletions.
20 changes: 1 addition & 19 deletions nominatim/api/results.py
Original file line number Diff line number Diff line change
Expand Up @@ -491,24 +491,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:
Expand Down Expand Up @@ -569,7 +551,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')\
Expand Down
8 changes: 8 additions & 0 deletions test/bdd/api/search/queries.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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
| ID | class | type | display_name |
| 0 | waterway | river | Samina, Austria |

Scenario: House number search for non-street address
When sending json search query "6 Silum, Liechtenstein" with address
| accept-language |
Expand Down

0 comments on commit 5011fde

Please sign in to comment.