]> git.openstreetmap.org Git - nominatim.git/blobdiff - nominatim/api/search/geocoder.py
restrict base results in near search by rank
[nominatim.git] / nominatim / api / search / geocoder.py
index 7ff3ed08af9dcfa23c8072d4d57152a253930007..91c45b65a76e977f93cc770f6303557211af470d 100644 (file)
@@ -134,7 +134,10 @@ class ForwardGeocoder:
             return
 
         for result in results:
             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)
                 continue
             distance = 0.0
             norm = self.query_analyzer.normalize_text(result.display_name)