03-11-2024, 10:52 AM | #1 |
Grand Sorcerer
Posts: 11,791
Karma: 7029971
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Search for books with author notes and show one book per author
EDIT: See this post for an updated & generalized version of the following template search.
@Comfy.n asked me if there was a template search that for each author with a note would show one book by that author. It didn't matter which book. Here is that search. Showing one book per author might not be possible if the author is a coauthor on several books. For example, consider these books where All of A, B, and C have notes:
The search template gives priority to books with single authors. Extending the above example:
The template can easily be changed to check any field, for example series, tags, or some custom column. The search respects virtual libraries. Use the Advanced search / Template search to create the search. Template value field: yes Comparison type: Set/Not set Template: Spoiler:
Here is an image of the filled-in Advanced search dialog. Last edited by chaley; 03-13-2024 at 04:55 PM. Reason: Improve template performance |
03-11-2024, 11:34 AM | #2 |
want to learn what I want
Posts: 1,052
Karma: 6422750
Join Date: Sep 2020
Device: Calibre E-book viewer
|
Thanks so much, chaley! One of the reasons for this odd search is that it makes it easier to preview distinct author notes in the Book Details pane, which I have on the right side of the UI.
Now I'm thinking I could use a trimmed Comments custom column to be displayed above the Bio. So I would need one more tip: what template should I use to display a trimmed comments field above the author bio in BD, displaying only the first 300 characters from the Comments built in column? I gather from this thread that I could use something like: {comments:shorten(300,...,0)} Is that correct and also, would a PTM template be more suitable performace-wise? |
Advert | |
|
03-11-2024, 11:40 AM | #3 | ||
Grand Sorcerer
Posts: 11,791
Karma: 7029971
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
Code:
program: shorten($comments, 300, '...', 0) Quote:
|
||
03-11-2024, 12:04 PM | #4 |
want to learn what I want
Posts: 1,052
Karma: 6422750
Join Date: Sep 2020
Device: Calibre E-book viewer
|
That works smoothly.
I'm using the GPM one, and after creating the column with the option "Show as HTML in BD" unchecked, it would display the text with the blue clickable option to "Search all books with..." Then I left "show as html.." checked and it displayed as plain text, like I wanted. |
03-11-2024, 06:03 PM | #5 |
want to learn what I want
Posts: 1,052
Karma: 6422750
Join Date: Sep 2020
Device: Calibre E-book viewer
|
It takes a while to refresh the view if changing metadata while the query is active (whilst it's visible on the search bar, I mean), so I'm tagging temporarily the results as 'temp', then only changing metadata on the results after doing a new search for tag:temp.
|
Advert | |
|
03-11-2024, 06:12 PM | #6 |
Grand Sorcerer
Posts: 11,791
Karma: 7029971
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
That doesn't surprise me. The search looks at every book on the library to build an index of authors with notes, which requires multiple probes of the notes database. It is a very expensive compute- and disk-bound process.
Using a temporary tag is a good workaround. |
03-11-2024, 06:32 PM | #7 |
want to learn what I want
Posts: 1,052
Karma: 6422750
Join Date: Sep 2020
Device: Calibre E-book viewer
|
This is off-topic, but I think you may know something about this issue.
In 2022, I was able to somewhat style the scrollbar for the Dark Theme. It was not perfect at all, but provided good visibility for the handle. Nowadays I'm used to do just keyboard commands like 'home' in cover grid view, and just forget the scrollbar. Also, that only worked with the system default UI style. With the recent addition of a more refined color customisation dialog, I've tried today two things: 1) try more combinations of colors in the dark theme for the currently customisable UI elements, but that didn't work well 2) I've tried runnning from source again and adding that code Kovid suggested in 2022, but the change wouldn't take. (that was args = sys.argv[:1] args += ['-stylesheet', 'test1.qss']) Some Qt based programs have a different scrollbar style in dark theme, where the handle has more like a light gray tone and the rest is black, so I wonder if that could somehow be tweaked in Calibre, with the recent Qt update. Last edited by Comfy.n; 03-11-2024 at 07:02 PM. |
03-11-2024, 06:34 PM | #8 |
Grand Sorcerer
Posts: 11,791
Karma: 7029971
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Sorry, but I have no idea.
|
03-12-2024, 08:35 PM | #9 |
want to learn what I want
Posts: 1,052
Karma: 6422750
Join Date: Sep 2020
Device: Calibre E-book viewer
|
Hi again,
Today I missed a way to restrict a search with the second part of this request. For example, a search for Code:
tags:biography listing_restriction:one book per author. Code:
languages:eng formats:epub listing_restriction:one book per author. |
03-13-2024, 12:39 AM | #10 | |
Grand Sorcerer
Posts: 11,791
Karma: 7029971
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
Code:
listing_restriction:one book per author The template search already respects the current VL. If you want it to respect some VL when no VL is currently applied, put that VL's search into the expression. For example, assuming the VL search expression is a saved search named "vl_search": Code:
search:vl_search and tags:foo and search:one_book_per_author |
|
03-13-2024, 12:47 AM | #11 |
want to learn what I want
Posts: 1,052
Karma: 6422750
Join Date: Sep 2020
Device: Calibre E-book viewer
|
The original request included filtering titles with author notes.
I can't use that to restrict a search for titles in my library that contain the tag:biography but don't contain author notes. I'm running the Extract People Metadata plugin on my libraries, which requires a lot of tweaking to get translators, original titles etc. and restricting any search to only one book per author would make it easier to spot the troublesome books for extracting that info... edit to add: As I see my original question, this is what it meant: a + b being a = has author notes b = restrict results to only one title per author And it does exactly that, however it does it in a way that B depends on A (or would it be A depending on B to list the results? I can't tell) Now, in my mind, if B could be run "independently", then I could do b + c, b + d, b + e etc. c, d and e being any other search. Maybe not possible, I suspect. Last edited by Comfy.n; 03-13-2024 at 01:22 AM. |
03-13-2024, 05:44 AM | #12 |
Groupie
Posts: 171
Karma: 158116
Join Date: Oct 2015
Device: Kobo Glo HD (landscape), Kobo Aura One
|
Forme it sounds that you are looking for
b = restrict results to only one title per author (without any further filter) and in addition - optional i.e. can be switched on/off: a = has author notes (which is in fact a subset of "b") |
03-13-2024, 05:45 AM | #13 |
Grand Sorcerer
Posts: 11,791
Karma: 7029971
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
I think you are asking that the template pay no attention to notes. Instead it takes a set of books and reduces that set to one book per author.
If true, then this pseudo search would do the same as the original template: Code:
search:has_author_notes and search:one_book_per_author Code:
not tag:foobar and search:one_book_per_author Do I have this right? |
03-13-2024, 06:17 AM | #14 |
Grand Sorcerer
Posts: 11,791
Karma: 7029971
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Try this to see if I understand you correctly.
If this is what you want then I will look at ways to eliminate the temporary VL. |
03-13-2024, 12:24 PM | #15 |
want to learn what I want
Posts: 1,052
Karma: 6422750
Join Date: Sep 2020
Device: Calibre E-book viewer
|
yes, and this reminds me that occasionally I might want to run just B on a whole library...
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Books sent to Amazon show with my email as ther author | Robmonster | Calibre | 9 | 11-05-2020 01:17 PM |
Show Books from Only 1 Author | RiffRaffAK | Library Management | 2 | 06-04-2020 10:26 AM |
Expanded search option for "Show books by the same author as the current book" ALT+A | Sisela | Library Management | 1 | 11-28-2015 09:54 AM |
author search in book details panel | mobic | Library Management | 3 | 11-26-2015 10:50 AM |
To show author and author sort as same? | pinky62 | Library Management | 5 | 03-18-2014 12:55 PM |