Search returns wrong results
See original GitHub issueDescribe 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
- npm install --save fuse.js
- copy and paste code below
- 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:
- Created 3 years ago
- Reactions:2
- Comments:8 (2 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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?
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.