The content: search operator does not work as intended

Steps to reproduce

I typed the word “alias” inside a note
I have other notes that contain the aliases property
Then I searched for “alias” using this:
content:(alias)

Did you follow the troubleshooting guide? [Y/N]

YES, I did use the Sandbox vault, and it still produces the same error

Expected result

I expect the content: search operator to match only the contents of the note, excluding the YAML header section
I want it to only match “alias” inside a note’s contents

Actual result

Right now, it matches the contents of the note AND the contents of the YAML header section
It matches “alias” inside the note contents and the YAML header section (the aliases property)

Environment

SYSTEM INFO:
Obsidian version: v1.9.12
Installer version: v1.6.7
Operating system: Darwin Kernel Version 25.0.0: Mon Aug 25 21:17:51 PDT 2025; root:xnu-12377.1.9~3/RELEASE_ARM64_T6000 25.0.0
Login status: logged in
Language: en
Catalyst license: insider
Insider build toggle: off
Live preview: on
Base theme: adapt to system
Community theme: none
Snippets enabled: 2
Restricted mode: off
Plugins installed: 7
Plugins enabled: 7
1: Vimrc Support v0.10.2
2: Relative Line Numbers v3.0.0
3: TagFolder v0.18.11
4: Dataview v0.5.68
5: Advanced Tables v0.22.1
6: Paste URL into selection v1.11.4
7: Tag Wrangler v0.6.4

RECOMMENDATIONS:
Custom theme and snippets: for cosmetic issues, please first try updating your theme and disabling your snippets. If still not fixed, please try to make the issue happen in the Sandbox Vault or disable community theme and snippets.
Community plugins: for bugs, please first try updating all your plugins to latest. If still not fixed, please try to make the issue happen in the Sandbox Vault or disable community plugins.


Additional information

Hi.

I don’t know if content searches are meant to exclude YAML headers or not, but as an alternative, you can negate the property to exclude it:

alias -[alias]
1 Like

I think the “content” operator is meant to contrast with the “file” and “path” operators (which it’s listed next to) not the properties search.

I read somewhere that the content: search operator skips the YAML header.
I assumed that was true.
However, if that’s not true, then aliases and tags in the header will also match using the content: operator.
In my opinion, the YAML header should be skipped if that’s not behavior, because if someone needs to search for aliases or tags, they have their own search operators for that.

Thank you for suggestion. I will use this as a workaround.

Obsidian possibly needs to create another search operator to search only within the YAML header.
For example: [header]
With this, you can do:
content:(searchTerm1 searchTerm2) -[header]

The documentation doesn’t explicitly say what it does; I had to guess based on where it is placed. I’ll file an issue on the Help docs GitHub if someone else doesn’t get to it first.

Obsidian already has a way to do that (https://help.obsidian.md/plugins/search#Search+properties). But if you mean it should have one to search only outside of properties, I think that might be worth posting a feature request for (if one doesn’t already exist).

1 Like

Thank you for taking the time to respond.
I very much appreciate it.
You have been very helpful.

One more thing.
I already knew about searching for properties and their values.
But I believe, that is for searching for specific properties and their values.
I want a facility to search any value or property inside the YAML section without specifying a specific property.
For example, search for “string1” in the YAML section only.

The properties search can contain other search operators, so you could use a regular expression to match any property name: [/.+/: example]. The example matches a property name containing one or more of any characters and a property value of “example”.

Actually, now that I look again it does say it searches “file content”. I can see how you interpreted it the way you did, but I think it may be clear enough in general (altho I imagine many readers will wonder why they would ever want to explicitly specify that). So I’m not going to file an issue (but feel free to, if you want.)

Wow. I never thought about using regex inside the property search like that.
So if that works, that means I can possibly use this:
-[/.+/: /.+/]
To exclude the YAML section

I just tried it. It didn’t work.

Using that will exclude any note that has properties.

The search result previews make it easy to think of search as finding parts of text, but what it actually finds are notes, with previews of each relevant place in the note. Often the distinction doesn’t matter, but this is a case where it does.

1 Like

Thank you for clarifying that. You have been very helpful, I appreciate it.
Like I said before, I wish there was a search operator or facility of some kind to search the YAML header only or exclude it entirely.
Right now, this feature does not exist in Obsidian

You are welcome to post a request for that in Feature requests (or comment if a request already exists).

1 Like

I created a Feature Request under a new topic called: « A search operator to search only in file contents, excluding the YAML header »

1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.