react-select-search icon indicating copy to clipboard operation
react-select-search copied to clipboard

search not working in groups

Open rjworks opened this issue 4 years ago • 2 comments

fuzzy search.js:

// eslint-disable-next-line import/no-extraneous-dependencies
import Fuse from 'fuse.js';

export default function fuzzySearch(options) {
    const fuse = new Fuse(options, {
        keys: ['name', 'value', 'items.name', 'items.value'],
        threshold: 0.3,
    });

    console.log(fuse)

    return (value) => {
        if (!value.length) {
            return options;
        }

        return fuse.search(value);
    };
}

SelectSearch

 <SelectSearch
                    options={options}
                    value={value}
                    onChange={setValue}
                    search={true}
                    emptyMessage="Not found"
                    placeholder="Try COSC 111"
                    printOptions="always"
                    autoFocus={true}
                    autoComplete={'off'}
                    filterOptions={fuzzySearch}
                />

It only filters the group name, and not the items within the group

rjworks avatar Jun 24 '21 02:06 rjworks

have the same issue, here is something similar but does not solve our problem https://github.com/tbleckert/react-select-search/issues/181

Antonji-py avatar Sep 13 '21 19:09 Antonji-py

I eventually went with react-select as this did everything.

markyoxall avatar Sep 14 '21 06:09 markyoxall