lib: Add support for automatically excluding tags from queries