-
-
Notifications
You must be signed in to change notification settings - Fork 18
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
Implements an extended and more forgiving search mentioned in #204.