svelte-search

Search that types back

Your own database does the searching: SQLite FTS5 or Postgres. Typos are forgiven word by word, and text folds the same way in any script. The autocomplete below runs in the browser over 48 cities, each under its local name and the names others use.

Try

Chosen: Kraków, Poland

This setup in code

const index = createSuggestionIndex(cities, {
  text: (c) => [c.name, ...c.aliases],
});

<SearchBox label="City" source={(q) => index.search(q, 6)} debounceMs={0}
  itemText={(c) => c.name} onselect={(c) => (chosen = c)} />

Normalize

normalize
hatha yoga near me krakow 31-503
near me?
yes, stripped
stop words out
hatha yoga krakow 31-503no locale, none to strip
postcode
noneneeds a locale pattern
trigrams
hataththayogogakrarakakokow31-1-5-50503

Similarity

edit distance
1a swap of two letters counts once
similarity
86%the quality gate keeps a fuzzy hit from about 75%
trigram overlap
43%

Distance

haversineKm
529.8
en
529.8 km · 49 minon foot, first 3 km
pl
529,8 km · 49 minon foot, first 3 km
de
529,8 km · 49 Min.on foot, first 3 km
ja
529.8 km · 49 分on foot, first 3 km