transitio.index.suggest

Contents

transitio.index.suggest#

transitio.index.suggest(prefix, *, limit=10, kinds=None, country=None, lang=None, index=None)#

Type-ahead: the places whose labels start with prefix, ranked.

Every label a place carries counts — its name, its names in other languages and its aliases — normalised as place() normalises a query, so hels and helsingf both reach Helsinki. Places rank by an exact label first, then kind precedence as places() ranks it, the label’s source (the name, a name in the place’s own languages or English, an alias, a name in another language), more feeds, the label and the id; one Suggestion per place, at most limit. kinds keeps only those kinds, country one ISO code or several, and lang picks the label to show (the place’s name in that language when it has one, else its name). An empty prefix suggests nothing. The index’s labels are sorted once, on the first call over it.