search
fun search(countries: List<Country>, query: String, fields: Set<CountrySearchField> = CountrySearchField.All, minQueryLength: Int = 1): List<CountryMatch>(source)
Filters and ranks countries against query.
A blank query (or one shorter than minQueryLength) is not a filter: every country is returned in the incoming order, unranked, so the caller can apply its own grouping.
Parameters
countries
Candidates, already narrowed by allow/exclude/region rules.
query
Raw user input. Trimmed, lowercased, accent-folded, and stripped of a leading + so "+254" and "254" behave identically.
fields
Which CountrySearchFields to consider. Omitting CountrySearchField.DialCode makes a purely numeric query match nothing, which is the point for non-phone pickers.
min Query Length
Below this length the query is ignored entirely.