Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Library Management

Notices

Reply
 
Thread Tools Search this Thread
Old 09-14-2025, 03:06 PM   #1
Far_Pen_6884
Enthusiast
Far_Pen_6884 began at the beginning.
 
Posts: 30
Karma: 10
Join Date: Jul 2025
Device: paperwhite
Question Searching for custom column #rating with calibredb gives unkown sort field

Hi all,

I use a custom boolean/float column named **#rating** (so I can store half-star values) instead of Calibre’s built-in rating column. When I try to search and sort by that custom column from the command line with calibredb I get errors like:
  • "Unknown sort field: #rating"
  • "Unknown fields: #rating"

Examples:

This fails:

Code:
calibredb list --search '#rating:True' --fields=rating,title,authors --sort-by='#rating'
Unknown sort field: #rating
This also fails:
Code:
calibredb list --search '#rating:True' --fields=#rating,title,authors --sort-by=rating
Unknown fields: #rating
This works but is useless to me because it shows the built-in column (all None for my books):
Code:
calibredb list --search '#rating:True' --fields=rating,title,authors --sort-by=rating
What I want
  • Search for books that have a value in my custom **#rating** column.
  • List title/authors and the custom **#rating** value.
  • Sort the results by my custom **#rating** values (in descending order).

Notes / what I’ve tried
  • I’ve tried quoting the column name, with and without the leading hash, and with/without spaces.
  • I’ve tried using the GUI to confirm the custom column name and type — it exists and contains values (including halves like 3.5).
  • I suspect calibredb either doesn’t accept custom column names with a leading “#” for --sort-by, or it expects a different syntax for custom columns.

Is there a supported way to reference custom columns (including those starting with “#”) in calibredb --fields, --search and --sort-by? If so, what is the exact syntax?
Far_Pen_6884 is offline   Reply With Quote
Old 09-14-2025, 06:03 PM   #2
Far_Pen_6884
Enthusiast
Far_Pen_6884 began at the beginning.
 
Posts: 30
Karma: 10
Join Date: Jul 2025
Device: paperwhite
As a workaround I believe I could copy all values from my custom #rating column to the default rating column, rounding either up or down to the closest full star value. Then I can just use the rating column that is working without problem. I've made another thread for that.
Far_Pen_6884 is offline   Reply With Quote
Old 09-14-2025, 09:24 PM   #3
BetterRed
null operator (he/him)
BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.
 
Posts: 21,890
Karma: 30277270
Join Date: Mar 2012
Location: Sydney Australia
Device: none
Moderator Notice
@Far_Pen_6884

I moved your posts here :

Click image for larger version

Name:	Screenshot 2025-09-15 112114.jpg
Views:	10
Size:	25.7 KB
ID:	218096

BR
BetterRed is offline   Reply With Quote
Old Yesterday, 07:09 AM   #4
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 12,509
Karma: 8065348
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
You can display custom columns by replacing the '#' with a '*' as documented under --fields in the calibredb list documentation and help text. Example using #my_rating instead of #rating:
Code:
calibredb --with-library=. list --fields=*my_rating,title --sort-by=rating --ascending
However, you are currently not able to sort by a custom column. I've submitted changes to fix that. With my changes (assuming they are accepted by Kovid) you can use
Code:
calibredb --with-library=. list --fields=*my_rating,title --sort-by=*my_rating --ascending
chaley is offline   Reply With Quote
Old Yesterday, 07:30 AM   #5
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 12,509
Karma: 8065348
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
The changes are in calibre source and will be in the next preview/release.
chaley is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Custom Column: Average Rating by Author Lys Library Management 5 12-09-2022 04:31 AM
Custom rating column in the database ownedbycats Library Management 6 03-16-2022 02:31 PM
Build Custom Stars Rating Column. oren64 Calibre 2 09-18-2016 04:18 AM
Custom column - Rating twstdwspr Library Management 7 09-24-2015 08:14 PM
Manual Sort or Sort by custom column Dethmaul Marvin 2 04-28-2014 11:54 AM


All times are GMT -4. The time now is 04:17 AM.


MobileRead.com is a privately owned, operated and funded community.