I have the following .md files.
For clarity, I’ll use screenshots instead of markdown.
My purpose is to search all the sections that contain both two tags, i.e.
A naive approach is to use
section:(#tag2 #tag3), the result is:
- Match section: - Match all of: - Matches text: "#tag2" - Matches text: "#tag3" - test1 4 - ## test1-heading #tag2 #tag3 - #tag2 #tag3
It included two result instead of 1. The 2nd one is in the code block and they are not tags.
I have turn on the “Explain search term”, it shown that engine was matching text rather than tag.
The obsidian doc says that
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
Therefore I rewrite the query:
section:((tag: tag2) (tag: tag3))
However it doesn’t work.
The “Explain search term” says
Operator “tag” cannot be nested within “section”.
So is there any way to work around this problem?
P.s. I also tried
((tag: tag2) (tag: tag3)) section:(#tag2 #tag3), it still return two results. BTW what does the space (that before “section”) here mean? AND or OR?