I read that you cannot limit tags to a block, because tag search always applies to the file.
But I also read here (and in the page’s examples) that you can group search expressions. This should only find notes that have at least one block that contains the word „dog“, but not the word „cat“.
block:(dog -cat)
Search‘s result are always whole notes. If you just want selected blocks in your result, Dataview plugin might be a better choice.
Thanks a lot for the reply. I realized that the tag function is applied to a specific file (when excluding any of the tags). I suggested this idea because the tag function indexes only the md text, and then it turns out that blocks of code with Dataview queries and so on also get into the search.
Code blocks are ignored when you search for tags. Same help page:
Note : Since tag: ignores matches in code blocks and in non-Markdown content, it’s often faster and more accurate than a normal full-text search for #work .
Yes, that’s why I thought it would be possible to combine blog and tag searches. (In my case, I have a lot of notes in which blocks are tagged and sometimes I need to look for nested tags. If I exclude the nested tag, then the search results for each note are excluded).
Yes, you are right. It really works. But this searches also in dataview queries and displays an incorrect number of results with data (as you understand, I don’t have any useful information in the dataview query that I would tag)