02-11-2024, 03:20 PM | #1 |
Enthusiast
Posts: 37
Karma: 10
Join Date: Oct 2020
Device: Kindle Paperwhite (1)
|
Search for book in top category only
Hello,
I have a custom category `genre` that contains sub categories, for example: Code:
entertainment entertainment.comicbook entertainment.humor entertainment.music entertainment.storytelling entertainment.television entertainment.writing Meaning all the books that have an assigned category `entertainment` BUT NONE of the subcategories of `entertainment`? I have tried this search but it doesn't work: Code:
#genre:"=entertainment" AND NOT #genre:"=.entertainment" Any idea? |
02-11-2024, 05:35 PM | #2 |
Grand Sorcerer
Posts: 12,046
Karma: 7548549
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Use the tag browser to see what the search expressions are. For example, click on the "entertainment" genre until you see a green single + sign then look at the search bar.
For more information see "‘Equality’ searches" in "The search interface" in the calibre manual. |
Advert | |
|
02-11-2024, 05:40 PM | #3 | |
Enthusiast
Posts: 37
Karma: 10
Join Date: Oct 2020
Device: Kindle Paperwhite (1)
|
Quote:
Code:
#genre:"=entertainment" Code:
#genre:"=.entertainment" |
|
02-11-2024, 05:44 PM | #4 | ||
Grand Sorcerer
Posts: 12,046
Karma: 7548549
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
Quote:
What exactly do you want to do? |
||
02-11-2024, 06:02 PM | #5 |
Grand Sorcerer
Posts: 12,046
Karma: 7548549
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
If your second post is the question you are asking, then this
Code:
#genre:"=.entertainment" and not #genre:"=entertainment" Code:
#genre:"~^entertainment\." |
Advert | |
|
02-11-2024, 11:27 PM | #6 | |
Enthusiast
Posts: 37
Karma: 10
Join Date: Oct 2020
Device: Kindle Paperwhite (1)
|
Quote:
I'll try to be more clear: - I have some books that have the top category only, and some books that have the top category AND any of the subcategories. - I need to search which books having the top category don't have any additional subcategories assigned. So logically it would be: lookup the top category only AND exclude any subcategory, but again, my example and also your examples do not work. To me this should be correct: Code:
#genre:"=entertainment" AND NOT #genre:"=.entertainment" |
|
02-12-2024, 02:35 AM | #7 |
Bibliophagist
Posts: 40,632
Karma: 157444382
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
|
Something like this with the '.' moved after entertainment?
Code:
#genre:"=entertainment" AND NOT #genre:"=entertainment." |
02-12-2024, 03:12 AM | #8 | |
Grand Sorcerer
Posts: 12,046
Karma: 7548549
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
This search, produced by the tag browser when the single green plus is showing Code:
#genre:"=entertainment" Examples:
|
|
02-13-2024, 05:20 PM | #9 |
Grand Sorcerer
Posts: 12,046
Karma: 7548549
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
I realized I misunderstood your posts. My apologies. And sorry for being super pedantic in this post. I am "thinking out loud".
To rephrase the question using sets, what (I think) you want is the intersection of two sets Code:
top_level_set ⋂ ~set_of_children
Computing top_level_set is easy using the search Code:
#genre:"=entertainment" Code:
#genre:"=.entertainment" Code:
(top_level_set ∪ set_of_children) Code:
top_level_set ⋂ ~(top_level_set ∪ set_of_children) We must find a search that finds children of entertainment, ignoring entertainment itself. The regexp search in post #5 and alluded to by @DNSB in post 7 Code:
#genre:"~^entertainment\." Putting the two together, the search Code:
#genre:"=entertainment" AND NOT #genre:"~^entertainment\." Code:
top_level_set ⋂ ~set_of_children Last edited by chaley; 02-13-2024 at 08:57 PM. |
Tags |
categories, category, genre, genre hierarchy, search |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Search and Go To controls at the top | lucille | Viewer | 4 | 04-12-2022 03:52 AM |
How to create virtual library to match the top most level category. | hlhp | Library Management | 2 | 03-21-2021 09:01 AM |
Saved Search window off top of screen? | Phssthpok | Editor | 2 | 11-26-2020 06:13 AM |
Putting sideloaded book in the Books category instead of Docs category | hopla | Amazon Kindle | 5 | 10-29-2018 07:40 PM |
Smart Search when Adding Category Information | Teeg | Calibre | 1 | 04-11-2018 08:59 AM |