You’re still hitting the same wall of page vs item scope. The FROM
is related to the note, aka page scope, so if the entire file has both, it’s happy. Then on the next line (with FLATTEN
) you split the page scope, and start using the item scope with stuff like WHERE item.quote and SORT item.source ASC.
In order to match each item against tags, you’ll need to extend the WHERE query with matches against its tags, so something like the following (replace the whole WHERE
statement):
WHERE item.quote
AND contains(item.tags, "#pin/class/quote")
AND contains(item.tags, "#pin/topic/politics/american/gop/anti-government")