krisk / Fuse

Lightweight fuzzy-search, in JavaScript
https://fusejs.io/
Apache License 2.0
17.89k stars 759 forks source link

Results not quite matching #369

Closed patrioticcow closed 4 years ago

patrioticcow commented 4 years ago

Here's a weird case:

Search Data:

[{"search":"2021 Ford Transit Connect"},{"search":"2020 Ford EcoSport"},{"search":"2020 Ford Edge"},{"search":"2020 Ford Escape"},{"search":"2020 Ford Expedition"},{"search":"2020 Ford Explorer"},{"search":"2020 Ford F-150"},{"search":"2020 Ford Fusion"},{"search":"2020 Ford Fusion Energi"},{"search":"2020 Ford Fusion Hybrid"},{"search":"2020 Ford Mustang"},{"search":"2020 Ford Ranger"},{"search":"2020 Ford Super Duty F-250"},{"search":"2020 Ford Super Duty F-350"},{"search":"2020 Ford Transit Connect"},{"search":"2020 Ford Transit Passenger Wagon"},{"search":"2020 Ford Transit Van"},{"search":"2019 Ford EcoSport"},{"search":"2019 Ford Edge"},{"search":"2019 Ford Escape"},{"search":"2019 Ford Expedition"},{"search":"2019 Ford Explorer"},{"search":"2019 Ford F-150"},{"search":"2019 Ford Fiesta"},{"search":"2019 Ford Flex"},{"search":"2019 Ford Fusion"},{"search":"2019 Ford Fusion Energi"},{"search":"2019 Ford Fusion Hybrid"},{"search":"2019 Ford Mustang"},{"search":"2019 Ford Ranger"},{"search":"2019 Ford Super Duty F-250"},{"search":"2019 Ford Super Duty F-350"},{"search":"2019 Ford Taurus"},{"search":"2019 Ford Transit Connect"},{"search":"2019 Ford Transit Passenger Wagon"},{"search":"2019 Ford Transit Van"},{"search":"2018 Ford C-Max"},{"search":"2018 Ford EcoSport"},{"search":"2018 Ford Edge"},{"search":"2018 Ford Escape"},{"search":"2018 Ford Expedition"},{"search":"2018 Ford Explorer"},{"search":"2018 Ford F-150"},{"search":"2018 Ford Fiesta"},{"search":"2018 Ford Flex"},{"search":"2018 Ford Focus"},{"search":"2018 Ford Fusion"},{"search":"2018 Ford Fusion Energi"},{"search":"2018 Ford Fusion Hybrid"},{"search":"2018 Ford Mustang"},{"search":"2018 Ford Super Duty F-250"},{"search":"2018 Ford Super Duty F-350"},{"search":"2018 Ford Taurus"},{"search":"2018 Ford Transit Connect"},{"search":"2018 Ford Transit Van"}]

and the search options

let options = {
  threshold: 0.6,
  location: 0,
  distance: 70,
  minMatchCharLength: 1,
  keys: [
    "search"
  ]
};
let fuse = new Fuse(list, options);
let result = fuse.search("F-250");

The search term is F-250

I expect to get Ford Super Duty F-250 at the top, but I don't

Any ideas?

danielfdickinson commented 4 years ago

At a guest it's because F-250 is at the end so it's lower in score than something that is closer to the beginning but has character mismatches (which are called 'errors' in bitap).

Regards,

Daniel

On 2020-03-25 8:30 p.m., Cristi C wrote:

Here's a weird case:

Search Data:

|[{"search":"2021 Ford Transit Connect"},{"search":"2020 Ford EcoSport"},{"search":"2020 Ford Edge"},{"search":"2020 Ford Escape"},{"search":"2020 Ford Expedition"},{"search":"2020 Ford Explorer"},{"search":"2020 Ford F-150"},{"search":"2020 Ford Fusion"},{"search":"2020 Ford Fusion Energi"},{"search":"2020 Ford Fusion Hybrid"},{"search":"2020 Ford Mustang"},{"search":"2020 Ford Ranger"},{"search":"2020 Ford Super Duty F-250"},{"search":"2020 Ford Super Duty F-350"},{"search":"2020 Ford Transit Connect"},{"search":"2020 Ford Transit Passenger Wagon"},{"search":"2020 Ford Transit Van"},{"search":"2019 Ford EcoSport"},{"search":"2019 Ford Edge"},{"search":"2019 Ford Escape"},{"search":"2019 Ford Expedition"},{"search":"2019 Ford Explorer"},{"search":"2019 Ford F-150"},{"search":"2019 Ford Fiesta"},{"search":"2019 Ford Flex"},{"search":"2019 Ford Fusion"},{"search":"2019 Ford Fusion Energi"},{"search":"2019 Ford Fusion Hybrid"},{"search":"2019 Ford Mustang"},{"search":"2019 Ford Ranger"},{"search":"2019 Ford Super Duty F-250"},{"search":"2019 Ford Super Duty F-350"},{"search":"2019 Ford Taurus"},{"search":"2019 Ford Transit Connect"},{"search":"2019 Ford Transit Passenger Wagon"},{"search":"2019 Ford Transit Van"},{"search":"2018 Ford C-Max"},{"search":"2018 Ford EcoSport"},{"search":"2018 Ford Edge"},{"search":"2018 Ford Escape"},{"search":"2018 Ford Expedition"},{"search":"2018 Ford Explorer"},{"search":"2018 Ford F-150"},{"search":"2018 Ford Fiesta"},{"search":"2018 Ford Flex"},{"search":"2018 Ford Focus"},{"search":"2018 Ford Fusion"},{"search":"2018 Ford Fusion Energi"},{"search":"2018 Ford Fusion Hybrid"},{"search":"2018 Ford Mustang"},{"search":"2018 Ford Super Duty F-250"},{"search":"2018 Ford Super Duty F-350"},{"search":"2018 Ford Taurus"},{"search":"2018 Ford Transit Connect"},{"search":"2018 Ford Transit Van"}] |

and the search options

|let options = { threshold: 0.6, location: 0, distance: 70, minMatchCharLength: 1, keys: [ "search" ] }; let fuse = new Fuse(list, options); let result = fuse.search("F-250"); |

The search term is |F-250|

I expect to get |Ford Super Duty F-250| at the top, but I don't

Any ideas?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/krisk/Fuse/issues/369, or unsubscribe https://github.com/notifications/unsubscribe-auth/AE6GOSQ4NGLWEBRIZLFK4LTRJKO23ANCNFSM4LT3H4SA.

patrioticcow commented 4 years ago

@cshoredaniel interesting.. I tested with the term being closer to the beginning I get better results, but still, F-150 shows up first, then F-250, and so on mixed together.

I would thing there should be a way to get more precise match.

[{"search":"Transit Connect 2021 Ford Transit Connect"},{"search":"EcoSport 2020 Ford EcoSport"},{"search":"Edge 2020 Ford Edge"},{"search":"Escape 2020 Ford Escape"},{"search":"Expedition 2020 Ford Expedition"},{"search":"Explorer 2020 Ford Explorer"},{"search":"F-150 2020 Ford F-150"},{"search":"Fusion 2020 Ford Fusion"},{"search":"Fusion Energi 2020 Ford Fusion Energi"},{"search":"Fusion Hybrid 2020 Ford Fusion Hybrid"},{"search":"Mustang 2020 Ford Mustang"},{"search":"Ranger 2020 Ford Ranger"},{"search":"Super Duty F-250 2020 Ford Super Duty F-250"},{"search":"Super Duty F-350 2020 Ford Super Duty F-350"},{"search":"Transit Connect 2020 Ford Transit Connect"},{"search":"Transit Passenger Wagon 2020 Ford Transit Passenger Wagon"},{"search":"Transit Van 2020 Ford Transit Van"},{"search":"EcoSport 2019 Ford EcoSport"},{"search":"Edge 2019 Ford Edge"},{"search":"Escape 2019 Ford Escape"},{"search":"Expedition 2019 Ford Expedition"},{"search":"Explorer 2019 Ford Explorer"},{"search":"F-150 2019 Ford F-150"},{"search":"Fiesta 2019 Ford Fiesta"},{"search":"Flex 2019 Ford Flex"},{"search":"Fusion 2019 Ford Fusion"},{"search":"Fusion Energi 2019 Ford Fusion Energi"},{"search":"Fusion Hybrid 2019 Ford Fusion Hybrid"},{"search":"Mustang 2019 Ford Mustang"},{"search":"Ranger 2019 Ford Ranger"},{"search":"Super Duty F-250 2019 Ford Super Duty F-250"},{"search":"Super Duty F-350 2019 Ford Super Duty F-350"},{"search":"Taurus 2019 Ford Taurus"},{"search":"Transit Connect 2019 Ford Transit Connect"},{"search":"Transit Passenger Wagon 2019 Ford Transit Passenger Wagon"},{"search":"Transit Van 2019 Ford Transit Van"},{"search":"C-Max 2018 Ford C-Max"},{"search":"EcoSport 2018 Ford EcoSport"},{"search":"Edge 2018 Ford Edge"},{"search":"Escape 2018 Ford Escape"},{"search":"Expedition 2018 Ford Expedition"},{"search":"Explorer 2018 Ford Explorer"},{"search":"F-150 2018 Ford F-150"},{"search":"Fiesta 2018 Ford Fiesta"},{"search":"Flex 2018 Ford Flex"},{"search":"Focus 2018 Ford Focus"},{"search":"Fusion 2018 Ford Fusion"},{"search":"Fusion Energi 2018 Ford Fusion Energi"},{"search":"Fusion Hybrid 2018 Ford Fusion Hybrid"},{"search":"Mustang 2018 Ford Mustang"},{"search":"Super Duty F-250 2018 Ford Super Duty F-250"},{"search":"Super Duty F-350 2018 Ford Super Duty F-350"},{"search":"Taurus 2018 Ford Taurus"},{"search":"Transit Connect 2018 Ford Transit Connect"},{"search":"Transit Van 2018 Ford Transit Van"}]
github-actions[bot] commented 4 years ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days