I have a composite column that splits and de-dupes the tags. Mostly because the long hierarchical tags look awful in the book details pane.
But an additional effect is that clicking on "Atlantic Canada" in the details pane will display books for
Fiction.Cultures & Regions.Canada.Atlantic Canada,
Nonfiction.Travel Guides.Canada.Atlantic Canada,
and
Nonfiction.History.Canada.Atlantic Canada.
Code:
program:
g = field('tags');
stripped_hierarchies = list_re_group(g, ',', '.',
# This ignores any subtags under specific top-level tags. I have separate columns for them.
'^(Fanfiction|Documentation & Manuals)($|\..*$)',
'{$}', '');
split_hierarchies = re(stripped_hierarchies, '\.', ',');
split_hierarchies = list_difference(
split_hierarchies,
# These are tags to explicitly ignore.
'@cleanup, Cultures & Regions',
',');
cleaned = list_union('', split_hierarchies, ',');
# Remove or comment this next line to get rid of the alphanetical sorting.
sorted = list_sort(cleaned, 0, ',')