Skip to content

Commit

Permalink
Merge pull request #3593 from lonvia/order-by-bbox
Browse files Browse the repository at this point in the history
Use bbox size for secondary order of results
  • Loading branch information
lonvia authored Nov 19, 2024
2 parents c172ca8 + 0770eaa commit 79836e5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/nominatim_api/search/geocoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def sort_and_cut_results(self, results: SearchResults) -> SearchResults:
limit to the configured number of results.
"""
if results:
results.sort(key=lambda r: r.ranking)
results.sort(key=lambda r: (r.ranking, 0 if r.bbox is None else -r.bbox.area))
min_rank = results[0].rank_search
min_ranking = results[0].ranking
results = SearchResults(r for r in results
Expand Down

0 comments on commit 79836e5

Please sign in to comment.