Merge pull request #3593 from lonvia/order-by-bbox

Use bbox size for secondary order of results
This commit is contained in:
Sarah Hoffmann 2024-11-19 11:50:55 +01:00 committed by GitHub
commit 79836e51d6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -116,7 +116,7 @@ class ForwardGeocoder:
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