Indeed it isn't, in order to make file-level querying performant at all, you really need support for that at the filesystem level. Which is exactly what BFS, the BeOS filesystem had, and of course Haiku reimplements it: https://www.haiku-os.org/docs/userguide/en/queries.html
As that page describes, the "query" command (or its equivalent GUI) can be used to write filesystem queries, e.g.:
As that page describes, the "query" command (or its equivalent GUI) can be used to write filesystem queries, e.g.: