Skip to content

Conversation

Jan-Koll
Copy link

Implements an extended and more forgiving search mentioned in #204.

@Jan-Koll Jan-Koll requested a review from jrpie June 26, 2025 21:06
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();
Copy link
Owner

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).

Jan-Koll added 4 commits June 27, 2025 11:36
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.
@jrpie jrpie force-pushed the master branch 2 times, most recently from a3e0165 to 2e95387 Compare September 9, 2025 20:16
@Dynge
Copy link

Dynge commented Sep 13, 2025

Would greatly appreciate this feature.

Any way I can help move it along ?

@jrpie jrpie force-pushed the master branch 2 times, most recently from dc3bebb to 2cda589 Compare September 14, 2025 19:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants