Obsidian Search Guide

Obsidian Search Guide

One of the weird things about squirrels is that they love to bury food, especially seeds, in as many places as they can get to safely. That would be totally normal if they later dug that food up. Instead, random things pop up out of the soil because a year (or maybe more) ago, a squirrel buried that seed and forgot about it.1

Note taking can be the same. Before I started writing digitally, I took notes in a set of notebooks. I had lots. Each notebook had lots of notes. Yet I was extremely unproductive.

Like the proverbial squirrel, I couldn't remember where I wrote ideas, so when I went looking for them, didn't find them. Between one note and the next of the same topic, there were dozens or hundreds of unrelated notes. I found the "system" never helped me think ideas through;

Worst of all, when I digitized my notes, I found multiple versions of almost exactly the same idea. What shocked me most was how many used almost exactly the same words!

As a result of this mess, I lost uncountable opportunities. Unlike the squirrel's buried seeds, mine never sprouted, surprising me with some wonderful result. They had remained buried in the books where I squirrelled them away.

Once you have more than a few documents, searching in Obsidian is a must! Once understood, search unlocks a world of exciting possibilities. So, follow me down the squirrel-hole of Obsidian search!

The TLDR video version:

Obsidian Search Overview

Let's say, you open the search in the left sidebar and type in the phrase "Obsidian Search". For me, this brings up 967 results!

There is no way I'm going to poke through so many.

The problem is that it finds those terms in all possible place to look

  • in the file name,
  • in the path leading to the file,
  • in the text, and
  • in the metadata properties.

We can target searches more accurately by indicating where we want to search with Obsidian search options. The following options are available and can be found in the left sidebar search (cmd-shft-f on Mac).

  • file:
  • path:
  • [property]
  • section:
  • line:
  • `tag:

Any one of these will improve your searching, so don't feel you have to use all of them. Let's take them on one at a time.

Finding Filenames with File:

file: is fairly obvious and refers to the file name. Obsidian searches for any text following the colon inside the name of the file. And not just the beginning. It can be anywhere inside the file.

For example, file:word brings up 214 results including

2021 11Nov 18 - Stytch - Kill the Password
Tarot Minor Swords Ace - 2023-04-30
Writing Publisher Smashwords - 2022-11-26

It also brings up 193 documents that contain the phrase "750 words", a tag I used for a number of years for my early-morning warm up writing.

If we wanted to find document with only that phrase in the title, "750 words", we would immediately run into a problem. Searching for file:750 words brings up only files with 750 in the title and ones which have "words" either in the title or in the text, resulting in 677 results.

AND = Space

This is because Obsidian interprets spaces as an AND. To find the exact phrase which contains a space then, we must wrap the phrase in quotation marks like this, file:"750 words"

Now, what if I was looking for documents that have "750 Words" and "Circle" in the title? Then we would use parentheses to indicate that the file name should have both. It would look like this:

file:("750 words" circle)
Results: 2

Notice how the parentheses come after the colon and group the 2 search phrases. This configuration means that both phrases must be in the filename.

Notice, too, how the number of results dropped. Unlike using AND in speech, which means one thing plus another thing making the result larger, in search, the opposite occurs. AND forces both conditions to be true, and the stricter search means fewer results.

path:-Finding

file: refers to the filename and path is the how to get the file.

If you're on a Mac, the path probably starts with /Users/… and on Windows C:\\…. Between each \ or / is the name of a folder.

Inside Obsidian the "root" or very first folder is the folder that is your Obsidian vault. So, while the full path to my Projects folder is /Users/robertfrost/MyDocuments/Second Brain/Projects, when searching in Obsidian, we can simply say, path:Projects.

Searching on particular paths is extremely useful. For example, I have a "VTO" document for each of my active projects. The search file:vto turns up over a dozens results.

Adding the project path like path:chartless file:vto brings up exactly the one VTO for the Chartless Trading project.

Getting Meta with [property]

Obsidian uses a YAML section at the top of the document to store metadata about the document. In source mode, this always looks like 3 dashes, some data in the form of key: value followed by 3 dashes to close the YAML section. Something like this…

---
title: "My terrific Document"
date: 2024-12-11
---

YAML is extremely flexible and you can put almost anything in there. That's great, but it's nit-picky about spacing when nesting values. Which isn't great for anyone who just wants it to work.

Obsidian put together a clever work around by branding YAML as "Properties" and making it easy to add new properties in Edit mode with a click. Using this interface, users get the spacing right and a few other bells and whistles.

Even better, properties are searchable.

The syntax is different from file: or path:. It start with square brackets and then the key and value are separated by a colon inside the brackets.

For example, if you have the property date: as a property in your documents and use the date format like "2024-12-31", you can search for all the documents dated in December 2024 with the search, [date:2024-12].

Searching in a section:

The next search option Obsidian provides is section:.

A section is any text between two headings of the same level. For example, the section "Furry Pets" in the example below includes the level 2 headings "Dogs" and "Cats". It ends just before the next level 1 heading "Flying and Swimming Pets". The level 2 section "Dogs", however, ends just before "Cats".

# Furry Pets
This section contains text about dogs and cats.

##  Dogs
A section about dogs.

##  Cats
a section about cats.

# Flying and Swimming Pets
This section contains text about birds and fish.

The search section:Dogs will find text in header level 2 "Dogs". The search section:"Furry Pets" Dogs will find text "…about dogs and cats" and "…about dogs".

Searching the Same line:

Finding text inside a note with exact the phrase "Obsidian search" is accomplished simply by wrapping the phrase in double quotes.

This falls apart when you're not sure of the order of the text. Was it "search Obsidian" or "Obsidian search"? Or were there there intervening words like "search inside Obsidian"?

This is where line: shines. The search line:(Obsidian search) finds both of the terms anywhere on the same line.

What was that tag:?

This section is really short for two reasons. Firstly, I don't use tags, so If find this search option mostly useless, like an appendix---must be nice for other people, but I don't think I need mine, thanks. Secondly, Obsidian makes searching tags so easy that a stray click can turn into a tag search.

If you've gotten this far, the only thing top point out for this search option is that like the others, you can use tag:(tag1 tag2 … tag9) to easily search multiple tags

Booleans: AND / OR

Earlier we discussed how by default, a space means AND (notice the all caps, to differentiate between a search for "and"). These searches all mean AND, returning the same results (just 1 for me). `

  1. file:meditation file:psychology
  2. file:meditation AND file:psychology
  3. file:(meditation psychology)

As mentioned above, AND reduces the number of results and OR increases the number of results. Using OR instead of AND in the previous searches is shown below.

  1. file:meditation OR file:psychology
  2. file:meditation OR AND file:psychology
  3. file:(meditation OR psychology)

For me, these searches produce 131 results, including the notes:

  • [[Meditation Awareness v Mindfulness - 2019-10-26]]
  • [[Psychology Consciousness Problem Hard Chalmers - 2024-09-07]]

With AND, both search terms must be in the filename. With OR, as long as either one appears, the filename shows up in the results.

We can continue adding () to make our meaning clear. For example, file:(psychology OR meditation Sunday) brings up 131 results for me. But do we mean that the filename must contain "Sunday" and either "psychology" or "meditation"? Or do we mean that it should contain either "psychology" or "meditation" together with "Sunday"?

We can clarify our meaning like this:

  • file:((psychology OR meditation) Sunday) means the filename must contain "Sunday" and either "psychology" or "meditation".
  • file:(psychology OR (meditation Sunday)) means should contain either "psychology" or "meditation" together with "Sunday".

Learning to Search

Once I learned to search Obsidian effectively, it unlocked unbelievable opportunities. Unlike the squirrel, always wondering where my loot went, I found my files and my ideas. Instead of thinking in circles and writing the same thing obsessively, I started building notes out and thinking thoughts through to the end.

I wish you massive success with your Obsidian searching!