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

Number arrays not finding results. #738

Open
1 of 2 tasks
marceloverdijk opened this issue Oct 16, 2023 · 2 comments
Open
1 of 2 tasks

Number arrays not finding results. #738

marceloverdijk opened this issue Oct 16, 2023 · 2 comments
Labels

Comments

@marceloverdijk
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Description of the bug

Number arrays not finding results.

The Fuse.js version where this bug is happening.

6.6.2

Is this a regression?

  • This is a regression bug

Which version did this behavior use to work in?

6.6.2

Steps To Reproduce

[
  {
    "title": "Some title",
    "years": [2022, 2023]
  }
]

const options = {
  includeScore: true,
  keys: ['title', 'years']
}

const fuse = new Fuse(list, options)

const result = fuse.search('2022')

Won't find the entry.

Changing the array from numbers to string it will work:
"years": [2022, 2023] ==> "years": ['2022', '2023']

But I need to actual numbers.

Note that this also works:

[
  {
    "title": "Some title",
    "years": [
      { "year": 2022 },
      { "year": 2023 }
    ]
  }
]

const options = {
  includeScore: true,
  keys: ['title', 'years.year']
}

const fuse = new Fuse(list, options)

const result = fuse.search('2022')

In that case the number is matched.

So it only happend for number arrays.

Expected behavior

Number arrays to be supported.

Screenshots

No response

Additional context

No response

Copy link

This issue is stale because it has been open 120 days with no activity. Remove stale label or comment or this will be closed in 30 days

@github-actions github-actions bot added the Stale label Feb 14, 2024
@marceloverdijk
Copy link
Author

Please don not close, this is an actual issue.

@github-actions github-actions bot removed the Stale label Feb 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant