comigor / fuzzy

Fuzzy search in Dart
MIT License
37 stars 20 forks source link

Inconsistant search result #22

Open pognibene opened 3 years ago

pognibene commented 3 years ago

Hi,

I have a small set of strings to search:

first_name_6 last_name_6 first_name_2 last_name_2 first_name_1 last_name_1 first_name_5 last_name_5 first_name_4 last_name_4 first_name_3 last_name_3

(it's a single string field).

Searching with different parameters yields inconsistent results:

6 => first_name_6 last_name_6

_6 => first_name_6 last_name_6

name_6 => first_name_6 last_name_6 first_name_2 last_name_2 first_name_1 last_name_1 first_name_5 last_name_5 first_name_4 last_name_4 first_name_3 last_name_3

This last search should result in only the first line... Any hint? Seems to be linked to the presence of an '_' in the strings.

BTW my configuration:

_fuse = Fuzzy<model.TribeMember>(
      _members,
      options: FuzzyOptions(
        findAllMatches: true,
        keys: [
          WeightedKey(name: "fullName", getter: (i) => i.fullName, weight: 1.0)
        ],
        threshold: 0.4,
        isCaseSensitive: false,
      ),
    );