View Single Post
Old 02-13-2024, 04:20 PM   #9
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,476
Karma: 8025702
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by groob View Post
Thanks for your help,
I'll try to be more clear:
[...]
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
where
  • top_level_set is the books that contain the bare (top-level) genre "entertainment".
  • set_of_children is the books that contain children of "entertainment".

Computing top_level_set is easy using the search
Code:
#genre:"=entertainment"
Computing set_of_children is more problematic. As you noted, the search
Code:
#genre:"=.entertainment"
can't be used for set_of_children because the search builds the set
Code:
(top_level_set ∪ set_of_children)
The expression
Code:
top_level_set ⋂ ~(top_level_set ∪ set_of_children)
is the empty set.

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\."
builds set_of_children by finding the set of books where "entertainment" is followed by a period.

Putting the two together, the search
Code:
#genre:"=entertainment" AND NOT #genre:"~^entertainment\."
builds the intersection we want
Code:
top_level_set ⋂ ~set_of_children
These screen captures shows that the search works. The first shows the books without a search. The second shows the books after applying the search.
Attached Thumbnails
Click image for larger version

Name:	Clipboard03.jpg
Views:	165
Size:	37.8 KB
ID:	206376   Click image for larger version

Name:	Clipboard02.jpg
Views:	152
Size:	27.0 KB
ID:	206377  

Last edited by chaley; 02-13-2024 at 07:57 PM.
chaley is offline   Reply With Quote