Skip to content

Albums not sorted in search results if FTS enabled #1665

Description

@CDrummond

Describe the bug
If FTS is enabled, then the order of albums in a "search" response appears to be random.

To Reproduce
Steps to reproduce the behavior:

JSONRPC query (sent via curl):

curl 'http://localhost:9000/jsonrpc.js' --data-raw '{"id":1,"method":"slim.request","params":["",["albums",0,500,"search:abba"]]}'

...and even if a "sort" is provided:

curl 'http://localhost:9000/jsonrpc.js' --data-raw '{"id":1,"method":"slim.request","params":["",["albums",0,500,"search:abba", "sort:album"]]}'

Expected behavior
Albums in the response should be sorted - and the CLI docs state that "album" is the default sort.

System Information (please complete the following information):

  • Ubuntu 26.04
  • x86_64
  • Default and Material skin
  • Chromium
  • LMS 9.2.0

Additional context
Related Material Skin issue: CDrummond/lms-material#1265

Activity

michaelherger commented on Sep 14, 2026

@michaelherger
Member

The documentation might be behind reality. The results are well sorted, but as the reporter on your repository probably correctly claims: unintuitively. The order is what the plugin thinks is "relevance": eg. a direct hit in titles would be rated more relevant than a hit in the lyrics etc.

CDrummond commented on Sep 14, 2026

@CDrummond
ContributorAuthor

Hmmm... But when I search for (e.g.) "ABBA" - I get the artist "ABBA", and then a list of albums by ABBA. I only get this list of albums if FTS is enabled. Assuming it has found "ABBA" as the artist then I'd expect the albums to be sub-sorted by name - as I would have thought they'd all have the same relevance score (all by artist "ABBA"). Perhaps this is what is required? e.g. if "relevance" is the same, sub-sort on title?

Or, override the "relevance" sorting and use the "sort:" field - if, and only if, supplied? But I guess that'd have performance issues if a large number of hits.

BoxSoft commented on Sep 14, 2026

@BoxSoft

I'm the user who initially reported the issue on the Material Skin repo. Yes, I have Full text search enabled. It wasn't until yesterday that I realized that clicking on the artist's name in the Artists results would show them sorted by Year (as specified elsewhere in my settings). If, instead, I click on the [More] button in the "Releases" area below that, then the results are more expansive.

I would question whether "relevance" is going to be the preferred sort for the results. That's fine as a default, but it would be nice to have an option, if possible.

In the meantime, I'll try to remember to pick the artist's name. That can unobvious, as their name is just a bit of text, whereas the releases are accompanied by a bunch of album images, suggesting that it's a better (or at least more obvious) batch of results. Having to second guess oneself is always a pain. 🤣

mikeysas commented on Sep 16, 2026

@mikeysas

I would question whether "relevance" is going to be the preferred sort for the results. That's fine as a default, but it would be nice to have an option, if possible.

On the assumption that you are searching for a contributors name, I understand your suggestion that it would be nice if you had an option to sort the list of albums like in the browse menus, but this is free text search and that might not be the users intent.

If I search “Duke” in my library, although the resulting album list includes a bunch of releases by Duke Ellington, the first album is Duke by Genesis followed by a by a bunch of tribute albums to Duke Ellington by other artist that include Duke in the album name. I think it is logical that the Genesis is the first result because it is the most relevant (exact match by album name). That is perfect if I was searching for an album with Duke in the title. On the other hand if I was searching for the artist, I click Duke Ellington’s name under Artist to see a complete albums by Duke Ellington sorted by my preference. In this case, I am not sure how sorting that album search result list by year (my preference setting) would be helpful, but that is just my personal perspective.

CDrummond commented on Sep 17, 2026

@CDrummond
ContributorAuthor

I am not sure how sorting that album search result list by year (my preference setting) would be helpful, but that is just my personal perspective.

I'm not advocating allowing a sort order here. But if a group of entries has the same relevance score, then they should be sub-sorted by their title. In the case of searching for an artist - if a group of albums is returned for that artist, then I'd assume they have the same score (as they all matched on the artist name). That group of albums should then be ordered by title. So, yes the first order of sort is relevance, but then equal relevance items should be sub-sorted.

michaelherger commented on Sep 19, 2026

@michaelherger
Member

The "relevance" sorting unfortunately is quite complex - and probably opinionated. As this is full text search, even findings in comments, lyrics (if embedded) etc. are taken into account. The weighing is something I defined at some point. But I'm sure all of this could be tweaked. It just needs time and a lot of testing.

I don't know, maybe even sorting alphabetically within the result set, after selecting the result set by relevance, might be ok?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions