X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/c42273a4db2d7b4fe05a0be9210901d35e038887..261e0cfd5a084dc5de333eda1093a9e7635c4859:/test/python/api/search/test_db_search_builder.py?ds=sidebyside diff --git a/test/python/api/search/test_db_search_builder.py b/test/python/api/search/test_db_search_builder.py index 9631850e..63589ffc 100644 --- a/test/python/api/search/test_db_search_builder.py +++ b/test/python/api/search/test_db_search_builder.py @@ -382,7 +382,7 @@ def test_frequent_partials_in_name_but_not_in_address(): def test_frequent_partials_in_name_and_address(): - searches = make_counted_searches(10000, 1, 10000, 1) + searches = make_counted_searches(9999, 1, 9999, 1) assert len(searches) == 2 @@ -393,3 +393,15 @@ def test_frequent_partials_in_name_and_address(): {('name_vector', 'lookup_any'), ('nameaddress_vector', 'restrict')} assert set((l.column, l.lookup_type) for l in searches[1].lookups) == \ {('nameaddress_vector', 'lookup_all'), ('name_vector', 'lookup_all')} + + +def test_too_frequent_partials_in_name_and_address(): + searches = make_counted_searches(10000, 1, 10000, 1) + + assert len(searches) == 1 + + assert all(isinstance(s, dbs.PlaceSearch) for s in searches) + searches.sort(key=lambda s: s.penalty) + + assert set((l.column, l.lookup_type) for l in searches[0].lookups) == \ + {('name_vector', 'lookup_any'), ('nameaddress_vector', 'restrict')}