order near searches by distance instead of importance

This commit is contained in:
Sarah Hoffmann
2023-11-26 16:48:04 +01:00
parent 8fcc2bb7f5
commit 580a7b032f
2 changed files with 14 additions and 13 deletions

View File

@@ -134,7 +134,10 @@ class ForwardGeocoder:
return
for result in results:
if not result.display_name:
# Negative importance indicates ordering by distance, which is
# more important than word matching.
if not result.display_name\
or (result.importance is not None and result.importance < 0):
continue
distance = 0.0
norm = self.query_analyzer.normalize_text(result.display_name)