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.

FuzzySearch options

See original GitHub issue

I had problems with sending options to FuzzySearch. If you look at the fuzzy search page, it says:

var fuzzyOptions = { searchClass: “fuzzy-search”, location: 0, distance: 100, threshold: 0.4, multiSearch: true }; var options = { valueNames: [ ‘name’, ‘category’ ], plugins: [ ListFuzzySearch() ] };

var listObj = new List(‘list-id’, options);

As far as I can see, the fuzzy options are never sent to the fuzzy search plugin, and so the default is always used regardless of what values you put in the fuzzyOptions. There is also no info about where to send in the options, but after a bit of debugging I found that I could send it in to the constructor: ListFuzzySearch(fuzzyOptions)

Then on to the next problem. Once I sent in the options, nothing changed. Seems that the “module.exports = function extend (object)”-function just overwrote the options I sent in with the default options. So I had to change from

for (var i = 0, source; source = args[i]; i++) {
    if (!source) continue;
    for (var property in source) {
        object[property] = source[property];
    }
}

to

for (var i = 0, source; source = args[i]; i++) {
    if (!source) continue;
    for (var property in source) {
        if (typeof object[property] == 'undefined') {
            object[property] = source[property];
        }
    }
}   

to protect my options from being overwritten

And by the way, setting threshold: 0.0 doesn’t disable fuzzy search like it says in the documentation. Instead it switches to the default value of 0.4 in this line: var Match_Threshold = options.threshold || 0.4;

But a value of 0.000001 almooost disables it 😃

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Reactions:1
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

4reactions
timothyjohcommented, Jul 20, 2016

I noticed this today too. Is this abandonware? How come there is no new release or simple fix to this a year later?

+1 to get this fixed

2reactions
javvecommented, May 10, 2015

There is a bug in the fuzzy search options that will be fixed in the next version.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Tiny and blazing-fast fuzzy search in JavaScript - GitHub
Fuzzy searching allows for flexibly matching a string with partial input, useful for filtering data very quickly based on lightweight user input.
Read more >
Available Fuzzy Search Options - SAP Help Portal
Name of Option Short Name Default Applies to Types emptyScore es not set Text, String, Date emptyMatchesNull emn off Text, String, Date returnAll ra off Text,...
Read more >
Fuzzy search plugin - List.js
Perfect library for adding search, sort, filters and flexibility to tables, lists and various HTML elements. Built to be invisible and work on...
Read more >
@types/fuzzy-search - npm
Start using @types/fuzzy-search in your project by running `npm i @types/fuzzy-search`. ... keys: string[]; options: Required<FuzzySearch.
Read more >
Class FuzzySearch | Quick Search | 2.1.0-preview.5
Utility class to perform matching against query text using a fuzzy search algorithm. ... Performs a fuzzy search on a string to see...
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