-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Sorting support in beets query mecanism (dbcore) #749
Comments
One proposal for human-writable sorting options: prefix the field with a Of course, there are obvious problems with typing backslashes in most shells and forward slashes indicate paths, so maybe we need a better idea. |
json-api, and sevarl other sources, suggests using - for desceding sort : I was thinking we could use the same convention, and add a "+" for ascending sort, allowing comma-separated fields to support multiple sort criteria. For example, listing tracks with genre "pop", sorting by artist (ascending) then by year (descending) :
We could also add a 'sort' indicator like this |
Not a bad approach at all. One tricky bit is that |
hum, I dont' really like What about prefixing sort criteria with a character, maybe
|
or using the sort character as suffix?
|
Suffix seems like a good choice. It makes the query read alot like natural language. Beet list tracks where Genre equals Pop, sort by Artist Ascending, Year On 6 May 2014 21:30, Fabrice L. notifications@github.com wrote:
|
Yeah, I like the suffix idea! Seems unlikely to conflict with any other meanings. I actually don't think the comma is really necessary. It seems easy enough to parse |
Yeah, the commas we only intended for the "translation" not the actual query On 6 May 2014 23:51, Adrian Sampson notifications@github.com wrote:
|
For information, I have a first implementation in my repo. It's far from complete and only supports fixed fields for now but I'd like to share to gather first impressions on the general direction. What I want to implement now :
|
Looks good to me so far! As far as the API goes, it looks like Thanks for looking into this! |
I did a little refactoring today that moved most of the query parsing code to a new |
I all made some (slow...) progress on this. This branch has now support for fixed and flex fields sorting, both implemented in sql. still missing :
|
Awesome! Does this:
mean that querying flex fields is also now implemented in SQL? Impressive either way. |
Querying flex flied is indeed implemented in SQL, but only for sorting purpose. It could be extended for generic queries (that is, to populate item objects) but only if the list of fields to retrieve is given. Otherwise you need another query to get the list of flexattr key, which kind of defeat the purpose ... Still, we could extract the list of flexattr key from the template and them query them directly in SQL. |
Ok, it's almost complete now :) |
Woohoo; done! |
The creation of this issue has been discussed in #736.
To implement correctly sorting support in the HTTP API (#736) , we need to add support for sorting directly into the query system inside the core (currently, sort order is hardcoded library#albums and library#items).
It would also be nice if users could easily type sorting options as part of queries, even on the command line.
The text was updated successfully, but these errors were encountered: