finamp
finamp copied to clipboard
Prioritize exact matches in search
Currently, Finamp seems to use some sort of fuzzy search that matches substrings anywhere in the song title / item name.
However, the sorting of the matches seems to depend on the some other factor, probably the way the items are ordered in the DB.
What I would like to see is the following:
Search term: "red"
Matched item names (sorted):
- Red
- Red (Extended Mix)
- Paint It Red
- Redo
- United (RedMoon Remix)
- Infrared
- End Credits
Essentially:
- Exact and full matches at the beginning of the name
- Exact matches at the beginning of the name
- Exact matches anywhere else
- Matches where the first word starts with the search term
- Matches where any word starts with the search term
- Matches where the end of any word matches the search term
- Anything else (substring in the middle of a word)
This probably sounds more complicated than it is to implement. The only prerequisite would be that the current matching is kept instead of a true fuzzy search that matches individual characters instead of just whole substrings, but that is probably a given anyway.
Thanks :)
Finamp seems to use some sort of fuzzy search that matches substrings anywhere in the song title / item name
For online mode, we just let Jellyfin handle it, for offline mode it's a very basic item.name.contains(search). We could make a better search system that is used by both online and offline.
But does Jellyfin provide a real "ranking"? The search results are fine, just the order could be improved. But yeah, I guess an on-device strategy might be a good idea either way
I don't think it does, it's the same endpoint, just with searchTerm specified as a query parameter. An on-device strategy would in theory be the best, although I'd be concerned about performance with large libraries as we'd have to pull the whole library down at once.
On the client, this could likely be done with https://pub.dev/packages/fuzzywuzzy
Fuzzy search over key-value pairs shouldn't be too slow I think, if you don't pull all the meta info but just the title, artist, and ID, that might work...
I encounter this often and it is a bit annoying.
I think we can do some "post-processing" on the client (both online and offline), that updates the sorting of the returned result. The amount of items is already limited in that case.
It won't help if the search results don't contain the searched item at all, but it's a start.