Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to control search #115

Open
upadhyashweta opened this issue Sep 13, 2023 · 1 comment
Open

how to control search #115

upadhyashweta opened this issue Sep 13, 2023 · 1 comment

Comments

@upadhyashweta
Copy link

  1. how we can have parameter so restrict search say search has to start after we type 3 letters
  2. search is not strictly happening, check in demo, if i type Tit i can see 4 serach results which are not correct
@LucasFernandesBrazil
Copy link

  1. how we can have parameter so restrict search say search has to start after we type 3 letters

  2. search is not strictly happening, check in demo, if i type Tit i can see 4 serach results which are not correct

To customize the search, use fuseOptions in the component. To resolve the first point, you can add a configuration of minMatchCharLength: 3, while the second point can be resolved by identifying the search keys corresponding to your objects: keys: ['name', 'description'], .

Example of use:

      <ReactSearchAutocomplete
        items={packageInfo}
        onSearch={handleOnSearch}
        onHover={handleOnHover}
        onSelect={handleOnSelect}
        onFocus={handleOnFocus}
        autoFocus={autoFocus}
        formatResult={formatResult}
        maxResults={10}
        fuseOptions={{
          keys: ['name', 'description'],
          minMatchCharLength: 3,
        }}
      />

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants