]> git.openstreetmap.org Git - nominatim.git/blobdiff - nominatim/api/search/db_searches.py
Merge pull request #3293 from lonvia/rematch-against-country-code
[nominatim.git] / nominatim / api / search / db_searches.py
index 68447f6a7429e3c40eea224a433985d4c5a58631..555819e7451dac76042482cd101ffbdfd067c882 100644 (file)
@@ -484,7 +484,14 @@ class CountrySearch(AbstractSearch):
             result.bbox = Bbox.from_wkb(row.bbox)
             results.append(result)
 
-        return results or await self.lookup_in_country_table(conn, details)
+        if not results:
+            results = await self.lookup_in_country_table(conn, details)
+
+        if results:
+            details.min_rank = min(5, details.max_rank)
+            details.max_rank = min(25, details.max_rank)
+
+        return results
 
 
     async def lookup_in_country_table(self, conn: SearchConnection,