How to range through ALL data in a TOML file?

Hi good people of Hugo Forums.

I’ve got this TOML file:

books.toml
[javier]
    [javier.horror]
        [javier.horror.book_1]
            title           = "book horror 1 title"
            image           = "image book horror 1 url"
            url             = "book horror 1 url link"
            price           = "horror 9.99"
            length          = "novel"
            published       = "12/4/2015"

        [javier.horror.book_2]
            title           = "book horror 2 title"
            image           = "image horror book 2 url"
            url             = "book horror 2 url link"
            price           = "horror 19.99"
            length          = "novella"
            published       = "12/4/2012"
    [javier.adventure]
        [javier.adventure.book_1]
            title           = "book adventure 1 title"
            image           = "image book adventure 1 url"
            url             = "book adventure 1 url link"
            price           = "adventure 9.99"
            length          = "novel"
            published       = "12/4/2013"
    
        [javier.adventure.book_2]
            title           = "book adventure 2 title"
            image           = "image adventure book 2 url"
            url             = "book adventure 2 url link"
            price           = "adventure 19.99"
            length          = "novella"
            published       = "12/4/2010"

I can display what I want by doing:
{{ $.Site.Data.books.javier.adventure.book1 }}

Or by doing a range through a specific author’s genre books:

{{ range $.Site.Data.books.javier.horror }}
   {{ .title }}
{{ end }}

But how can I do a more general range? Sort of, list all by author (by two authors, for example), or by price? by published date? or by some other variable? (genre, length)

Extra points if someone has an answer that gets rid of that awful “book1, book2, book3” that in my infinite ignorance I managed to give birth to.

Cheers.

You cannot.

(but I wish for someone to prove me wrong)

I am assuming that’s a typo? And you meant to say that that code block is a file like data/books.toml?

Hi!

Yes, your assumption is correct (books.TOML)

Ahhh, almost there! This ain’t working for some reason!

{{ range where $.Site.Data.books.javier.horror.book_1 "length" "novel" }}
    {{ .title }}
{{ end }}