Skip to content

Commit

Permalink
Merge pull request #8 from danielgilbers/feature/searchbar
Browse files Browse the repository at this point in the history
add search limit and threshold
  • Loading branch information
danielgilbers authored Aug 27, 2024
2 parents 46ab72b + f35535c commit 888a926
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions js/Products.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ export function findProduct (query) {

export function searchProducts (query) {
const fuse = new Fuse(products, {
keys: ['name']
keys: ['name'],
threshold: 0.3
})
return fuse.search(query)
return fuse.search(query, { limit: 7 })
}

0 comments on commit 888a926

Please sign in to comment.