X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/4305160c91ffb2aebb54353e768821df46a49756..b427fc79656124cd91475ac26016f5865fbc04f3:/nominatim/api/search/db_searches.py?ds=inline diff --git a/nominatim/api/search/db_searches.py b/nominatim/api/search/db_searches.py index 68447f6a..555819e7 100644 --- a/nominatim/api/search/db_searches.py +++ b/nominatim/api/search/db_searches.py @@ -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,