Is it possible to search two tags (not text keywords) in the same section?

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. #tag2 and #tag3.

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

Note that

  1. It included two result instead of 1. The 2nd one is in the code block and they are not tags.

  2. I have turn on the “Explain search term”, it shown that engine was matching text rather than tag.

The obsidian doc says that

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.

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?

1 Like

From what you describe, I think it’s not possible. :frowning: I think it would be a good feature request (if one doesn’t already exist).

The space means “AND”.

I actually would have found those easier to understand as Markdown (inside code blocks). The search result might have been better as a a screenshot (altho less accessible, so maybe not).


A bit disappointed :slightly_frowning_face:.

I agree, but I found that I cannot edit this thread anymore…

I just searched #feature-requests tags:search tag in the forum, it seems no one mentioned. Do you know how to convert this thread to a feature request? Or I have to create a new thread ?

No biggie. It didn’t stop me from understanding the post, I just figured I’d mention since you’d specifically said it was for clarity.

It’s probably better to start a new thread — I think the FR section uses a different template.

But in general, you would click the edit button near the title. If you don’t see that button, you might not have that permission yet. I can edit other people’s posts, so feel free to ping me if you accidentally post in the wrong section.