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

feat: allow to pass a getFn for a specific key #627

Merged
merged 2 commits into from
May 3, 2022

Conversation

fakenickels
Copy link
Contributor

@fakenickels fakenickels commented Feb 23, 2022

This PR introduces the following

const fuse = new Fuse(Books, {
  useExtendedSearch: true,
  includeMatches: true,
  includeScore: true,
  threshold: 0.3,
  keys: [
    { name: "title", getFn: (book) => book.title },
    { name: "authorName", getFn: (book) => book.author.firstName },
  ],
});
const result = fuse.search({ title: "old man" });

I noticed it has been requested several times

Let me know if any other changes are necessary before merging

@fakenickels fakenickels reopened this Feb 23, 2022
@krisk krisk changed the title allow to pass a getFn for a specific key feat: allow to pass a getFn for a specific key Mar 2, 2022
@Aaronius
Copy link

Yes please!

@krisk krisk merged commit 203871f into krisk:master May 3, 2022
@krisk
Copy link
Owner

krisk commented May 3, 2022

This is great. As a follow-up to this, could you create a PR with the relevant docs updates?

@krisk
Copy link
Owner

krisk commented May 3, 2022

Could you make the requisite TS changes?

krisk pushed a commit that referenced this pull request May 3, 2022
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

Successfully merging this pull request may close these issues.

None yet

3 participants