How to search for notes with empty YAML option?

3 years ago by laurelinae to c/obsidianmd

How can I search for notes using the built-in search plugin, which supports regex, to search for notes that have no entry in specific keys within the frontmatter?

I am using templater and thus am using my frontmatter looks like this:

---

aliases:

publish: false

tag:

---

%%

date:: [[2023-07-11 Tue]]

parent:: [[XYZ]]

%%

Searching for "parent:: " works fine, but I want to find notes that do not have a parent note yet. For this I tried parent:: /$ as indicated here and here, but this and other variations like parent:: /\$/ do not yield any results.

Where am i going wrong?

load all comments
Luxbux84 6 points 3 years ago

I don't think the built-in search has this capability, but you can try this dataview query:

LIST
WHERE !parent
path: 0 1127665, hotness: undefined, score: 6, children: 1
laurelinae 2 points 3 years ago

Works like a charm! I didn't know that I could query not just from tags but from any YAML key. Thank you!

path: 0 1127665 1133278, hotness: undefined, score: 2, children: 0
obsidianmd
obsidianmd

@lemmy.world

login for more options
5109
194
52

Unofficial Lemmy community for https://obsidian.md

go to feed...