Search engines
VPick's built-in search matches text in the label, and in any searchKeys you name. When you need more, such as typo tolerance, relevance ranking or searching long descriptions, plug in a search engine through fetchOptions.
fetchOptions receives what the user typed and returns the matching options. VPick shows them in the order they come back, so the engine's ranking is kept, and handles the rest: waiting for typing to pause, cancelling stale requests, the searching and error rows, and keeping picked options after the results change.
Pick your engine
Fuse.jsFuzzy search in the browser. Forgives typos, ranks the closest matches first.FlexSearchFull-text search in the browser. Several fields, partial words, relevance ranking.Your serverAny backend: Meilisearch, Algolia, a database. The search runs where the data is.
Which one
| You have | Use |
|---|---|
| A few thousand short labels, and people misspell them | Fuse.js |
| Records with longer text, such as titles and descriptions | FlexSearch |
| More data than belongs in the page, or it changes often | Your server |
| Short labels, spelled right | Nothing extra. The built-in search is enough. |
VPick has no dependencies of its own, and none of these become one. You install the engine you choose in your app.