home-assistant / frontend

:lollipop: Frontend for Home Assistant
https://demo.home-assistant.io
Other
3.82k stars 2.62k forks source link

Add integration > Search ignores first letter #15361

Closed eikowagenknecht closed 1 year ago

eikowagenknecht commented 1 year ago

Checklist

Describe the issue you are experiencing

The search dialog ignores the first letter. E.g. "instar" searches for "nstar" instead.

image

Another example: image

Describe the behavior you expected

The first letter should be included in the search query.

Steps to reproduce the issue

  1. Click add integration
  2. enter "instar"
  3. see that "venstar" is shown ...

What version of Home Assistant Core has the issue?

core-2023.2.2

What was the last working version of Home Assistant Core?

No response

In which browser are you experiencing the issue with?

Google Chrome 109

Which operating system are you using to run this browser?

Windows 10

State of relevant entities

No response

Problem-relevant frontend configuration

No response

Javascript errors shown in your browser console/inspector

No response

Additional information

No response

Himanshu-Vishwas commented 1 year ago

okay so its basically not taking the string[0] search query parameter is there any for loop for searching words which begins from 1. this may be the issue of skipping the 0th-index.

karwosts commented 1 year ago

I don't think it's anything specific to the first letter, I think it's just some kind of fuzzy search matching that tries to be helpful in the presence of typos.

xbode, axode, abxde, aboxe, and abodx all bring up Abode as a result.

And looking at the source it uses Fuse.js for searching, and it has a threshold parameter of 0.2:

threshold Type: number Default: 0.6 At what point does the match algorithm give up. A threshold of 0.0 requires a perfect match (of both letters and location), a threshold of 1.0 would match anything.

So for 0.2 I would say that seems about right that it requires about 80% of the letters for a match.

Looks like working as intended.

piitaya commented 1 year ago

I confirm, it's a fuzzy search feature to avoid spelling mistake and have a better matching 🙂

eikowagenknecht commented 1 year ago

Oh wow, that's not what I expected. So not a bug at all I guess.

From a user experience perspective, I'd think it would be preferable to have only exact matches and only when there are no exact matches, then the fuzzy ones together with an indication like "No results for xbode, maybe you meant this instead?". Just like Google, Amazon and other often-used search fields handle it. This could avoid confusion.

In my example, I was thinking "Huh, maybe if Venstar is shown when I look for Instar, that's what they somehow named the HA integration for Instar? Or maybe an alias?" and only found out after clicking on that that it's not related at all.

github-actions[bot] commented 1 year ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.