Add 'prioritize' parameter to prefer synced or plain lyrics to /get and /search routes #46
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
There are situations when there are multiple best matches, but the first one only has plain lyrics, while others include synced, but are also exactly or closely matched. It appears to be that the results are sorted by
idor date added.This PR adds an optional parameter that enables soft prioritization logic, the ability to order lyrics by using a trivial
ORDER BYclause and existing DB columnshas_synced_lyricsandhas_plain_lyrics. It simply elevates the chosen kind to the top while keeping the match ranking and initial sort. If tracks with the chosen kind don't exist, the other kinds will be the top result as is.This logic could also be implemented without the parameter and enabled by default to prioritize synced lyrics. However, there are possibilities where it could mess up the search result if the user's query is not specific and relevant enough. It may give unrelated tracks that have synced lyrics.
Closes #28 #10