sickdyd / react-search-autocomplete

A search box that filters the provided array of objects
https://sickdyd.github.io/react-search-autocomplete
MIT License
220 stars 84 forks source link

It seems to completely ignore ignoreLocation=true #6

Closed MorpheusFT closed 3 years ago

MorpheusFT commented 3 years ago

The results it returns are only exact matches from the start of the strings.

search.ts

export const search_options = {
    ignoreLocation: true, // Pattern can be anywhere in string
    fuseOptions: {
        ignoreLocation: true, // Pattern can be anywhere in string
        threshold: 0, // How much the pattern much match and how much its location can deviate from location. 0=exact match
    },
};

some_component.tsx

<ReactSearchAutocomplete
    items={x}
    {...search_options}
/>
sickdyd commented 3 years ago

The previous dependency for Fuse.js was 3.6.1, a pretty old one.I updated the dependency and now it's using the latest version 6.4.4. This should solve your issue.