question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Search returns wrong results

See original GitHub issue

Describe the bug

Search does not return expected results.

Expected Result

Only one object returned

Actual Result

All items returned

Version

^6.4.3"

Is this a regression?

No - Never used before

🔬Minimal Reproduction

  1. npm install --save fuse.js
  2. copy and paste code below
  3. run

Specs:

macOS: 10.15.7 (19H15)

Additional context

import Fuse from ‘fuse.js’;

const list = [ { auditLog: “logs-1/.asjdfnjasbfa.json”, author: ‘John Scalzi’, tags: [‘fiction’] }, { auditLog: “logs-2/.ahjdfnjasbfa.json”, author: ‘Steve’, tags: [‘thriller’] } ]

const options = { // Search in author and in tags array keys: [‘auditLog’] }

const fuse = new Fuse(list, options)

const result = fuse.search(“logs-1”)

console.log(result)

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

5reactions
kennethbrentcommented, Feb 25, 2021

What would be the best way to get fuse to return only an exact match if there is one, likewise only return the partial matches if it can’t find an exact?

3reactions
kriskcommented, Jan 1, 2021

This is working as expected. If the search criteria is “logs-1”, it will match both “logs-1” and “logs-2”. Remember that Fuse is doing an approximate string matching (aka, fuzzy matching), and while “logs-1” is a perfect match, “logs-2” is a very close match nonetheless.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Search function bringing back wrong results
Hold Windows key + X. Click on Control Panel. Click on troubleshooting and click on view all. Now check for search and indexing...
Read more >
RefinementList search returning wrong results - Open Q&A
RefinementList search returning wrong results ... Hi,. I have developed a custom RefinementList widget using RefinementList | React InstantSearch ...
Read more >
Azure Search returning incorrect results - Stack Overflow
The search query speficies the value to look for and the column in which to search for it. However, I'm getting results returned...
Read more >
Why Is Windows 10 Search So Bad? Here Is How To Fix It
No doubt we've all been spoiled by Google returning search results in a fraction of a second, but there is no denying that...
Read more >
Global search returns wrong results while searching for IPs or ...
Global search returns wrong results while searching for IPs or MAC addresses even when the search query is put in "quotes". In this...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found