-
-
Notifications
You must be signed in to change notification settings - Fork 22
feat: add subsequent & fuzzy search #206
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Respect the fuzzy search preference again to stop computing the fuzzy results when it is not enabled
If multiple items contain the search string perfectly the fuzzy search still expand it with suggestions. These fuzzy-suggestions, however, might have **less** occurrences in the search string than the items that contained it. The changes ensure that fuzzy-suggestions must have at least the same amount of occurrences as apps that contain the search string. Also, I removed the `appsSecondary` wrapper-list and directly work on `r`.
| val r: MutableSet<AbstractDetailedAppInfo> = hashSetOf() | ||
| val normalizedQuery: String = normalize(query) | ||
| val subsequentResult: MutableList<AbstractDetailedAppInfo> = mutableListOf(); | ||
| val occurrences: MutableMap<AbstractDetailedAppInfo, Int> = mutableMapOf(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the approach of having multiple lists breaks down at this point. The approach with two list was mainly used to avoid sorting, but I think the code is getting very hard to read now.
I'd suggest calculating a score for each app, remove all where the score is too high, then sort them by score (and secondarily by name).
Changed the algorithm for occurrence counting to improve performance. Previously it was based on expensive string manipulations and checks. The new approach is based on a frequency map with fewer iterations.
a3e0165 to
2e95387
Compare
|
Would greatly appreciate this feature. Any way I can help move it along ? |
dc3bebb to
2cda589
Compare
Thanks for reaching out (and sorry for the very late reply). Frankly, the main problem is that I'm not very convinced by this feature. In particular, the interaction between this and auto-launch (which I consider a vital feature) is very confusing and hard to explain imho. Some thoughts:
The user could then select an arbitary, non-empty subset of these algorithms.
|
|
Thanks for the long detailed reply. I agree with your points and admittedly I have not thought it though as much as you clearly have, thanks for that! Personally I do not use it because of typos but rather for making searches that are more 'ergonimic' or intuitive (for me). E.g. to match "Ente Photos" when I also have "Ente Auth" installed, it would be easier to write "enp" to match the first part of ente and first part of photos. However with exact matches I have to write the entirety of "ente" or begin in the middle of the name which is not intuitive at all (to me). I agree that a naive fuzzy match would hinder the effectiveness of auto-launch, but I like your idea of only fuzzy searching when no exact match can be found. For me the auto-launch makes me explore how I can easily find and open the correct app as easily as possible, fuzzy matching opens the possibilities for more intuitive matches because you have more room to explore. |
Have you considered renamig apps for this purpose? (Might look ugly though)
This is actually what is implemented in this PR (the discussion has some history, see #204 ) |
Sounds like a manual and tedious approach 😅 Would much rather have fuzzy search to solve it. |
Implements an extended and more forgiving search mentioned in #204.