Try it out!
Given this list of books, try searching by misspelling the title or author's name:
The results are sorted by score. That is, the ones that match the strongest are first.
Suppose you have the following data structure:
Search and return a result list of identifiers
Search and return a result list of records
Search over a flat array, and return the indices
Fuse also allows for deep key search:
See here for all available options.
This isn't meant to work across hundreds of thousands, or millions of records. If you have that many records at once on the client, then you probably have bigger problems to worry about. To give you an idea of performance, searching over 2 keys in 20,000 records takes approximately 1 second. Still, 20k records is an awful lot. Ideally, a client-side fuzzy-search solution is only acceptable if the record-set is small, and the pattern string and keys' short.
Note: the pattern string cannot exceed 32 characters.
How does it do it?
Want to see more?
Check out this test page.
Currently planning to make it faster, and work for larger sets of data. Let me know your thoughts, ideas, or anything else.
Fuse.js has been successfully tested in the following browsers:
- Safari 4+
- Firefox 3.5+
- IE 6,7,8,9+
- Opera 10.6+
- Mobile Safari (iOS 4+)
If you encounter any problems, please use the GitHub issue tracker (GitHub account required).
For anything else, feel free to email me, or post a comment below.