useFuzzySearch()
Typo tolerance beside the exact index.
Signature
const { search } = useFuzzySearch(collection, {
ignoredTags: ['table'],
threshold: 0.35,
minMatchCharLength: 3,
limit: 20
});
Returns
A search function that scores near-misses.
Notes
It runs only when the exact search returns nothing, and the UI says so — a reader who mistyped should get the page, but should also be told that is what happened.
collection defaults to docs. ignoredTags is passed to Content while it
builds the searchable sections; threshold and minMatchCharLength tune Fuse,
and limit caps the returned near-misses. The site's defaults come from
duxt.search.fuzzy, while explicit options let another consumer of the
composable choose its own pass.
Was this page helpful?