A big thanks to LuukvE who made a commit from which I could create this Fuzzy Search plugin.
The difference between Fuzzy Search and List.js default search
The default search will conduct a time efficient search for an exact match in the content searched, while the fuzzy search will render results depending on if they are included anywhere in the content.
1 2 3 4 5 6 7 8 | |
Live example
Check out this -> Listjs.com/examples/fuzzy-search
Implementation
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | |
Options
All options are optional. Simplest implementation is: plugins: [ [ 'fuzzySearch' ] ]
- location (Int, default: 0)
Approximately where in the text is the pattern expected to be found? - distance (Int, default: 100)
Determines how close the match must be to the fuzzy location (specified above). An exact letter match which is ‘distance’ characters away from the fuzzy location would score as a complete mismatch. A distance of0requires the match be at the exact location specified, a threshold of1000would require a perfect match to be within 800 characters of the fuzzy location to be found using a 0.8 threshold. - threshold (Int, default: 0.4)
At what point does the match algorithm give up. A threshold of0.0requires a perfect match (of both letters and location), a threshold of1.0would match anything. - multiSearch (Boolean, default: true)
Subtract arguments from thesearchStringor putsearchStringas only argument
