The Search plugin helps you find files in your vault.
By default, you can find Search in the left sidebar (magnifying glass icon). You can also open Search by pressing Ctrl+Shift+F
(or Cmd+Shift+F
on macOS).
A search term is the word or phrase that you enter in the search field. Learning how to write search terms effectively can help you quickly find what you're looking for, even in large vaults. Obsidian only searches the contents of notes and canvases.
By default, you can only search the paths and filenames of notes and canvases. To search for a path or filename of any file in the vault, use the path
or file
operator.
Each word in the search term is matched independently within each file. To search for an exact phrase, surround it with quotes, for example "star wars"
. To search for quoted text within an exact phrase, you can escape the quotes by adding a backslash (\
) in front of the quote, for example "they said \"hello\" to each other"
.
You can control whether to return files that contain all the words in your search term, or any of the words:
meeting work
returns files that contain both meeting
and work
.meeting OR work
returns files that contain either meeting
or work
.You can even combine the two in the same search term.
meeting work OR meetup personal
returns files for work meetings and personal meetups.You can use parentheses to control the priority of each expression.
meeting (work OR meetup) personal
returns files that contain meeting
, personal
, and either work
or meetup
.To exclude, or negate, a word from the search results, add a hyphen (-
) in front of it:
meeting -work
returns files that contain meeting
but not work
.You can exclude multiple expressions:
meeting -work -meetup
returns files that contain meeting
but not work
or meetup
.You can exclude a combination of expressions using parentheses:
meeting -(work meetup)
returns files that contain meeting
but not both work
and meetup
.If you need to troubleshoot a complex search term, you can click Explain search term in Search for an explanation of your search term.
Search operators enable more fine-grained search queries to filter your results even more.
Some operators even allow you to add a nested search term within parentheses, for example: task:(call OR email)
.
Search operator | Description |
---|---|
file: |
Find text in filename. Matches any file in the vault. Example: |
path: |
Find text in file path. Matches any file in the vault. Example: |
content: |
Find text in file content. Example: |
match-case: |
Case-sensitive match. Example: |
ignore-case: |
Case-insensitive match. Example: |
tag: |
Find tag in file. Example: Note: Since |
line: |
Find matches on the same line. Example: |
block: |
Find matches in the same block. Example: Note: Since |
section: |
Find matches in the same section (text between two headings). Example: |
task: |
Find matches in a task on a block-by-block basis. Example: |
task-todo: |
Find matches in an uncompleted task on a block-by-block basis. Example: |
task-done: |
Find matches in a completed task on a block-by-block basis. Example: |
You can use data stored in Properties in your search terms.
Use brackets around a property name [property]
to return files with that property:
[aliases]
returns files that contain the aliases
propertyUse brackets and a colon [property:value]
to return files with that property and value:
[aliases:Name]
returns files where the aliases
property value is Name
Both property and value allow sub-queries, such as parentheses for grouping, the OR
operator, double-quotes for exact matching, and regex.
[status:Draft OR Published]
to find returns files where the status
property value is Draft
or Published
By default, search terms are not case sensitive. If you want to search for the exact case of your search term, click Match case ("Aa" icon) inside the search bar.
This setting can be toggled. If Match case icon is highlighted, that means you’re currently doing a case sensitive search.
The following options are available:
A regular expression is a set of characters that describe a text pattern. To use regular expressions in your search term, surround the expression with forward slashes (/
).
/\d{4}-\d{2}-\d{2}/
matches an ISO 8601 date, such as 2022-01-01.You can even combine regular expressions with search operators:
path:/\d{4}-\d{2}-\d{2}/
returns files with a date in the file path.For more information on how to write regular expressions, refer to Regular expressions
Regular expressions come in different flavors that may look different from each other. Obsidian uses JavaScript-flavored regular expressions.
To configure Search, click on Search settings (three rows of switches icon) on the right side of the search bar to see the toggles.
Setting | Description |
---|---|
Explain search term | Breaks down the search terms and explains it in plain text. |
Collapse results | Toggles whether to show the search context. |
Show more context | Expands the search result to show more text around the match. |
To embed search results in a note, add a query
code block:
```query
embed OR search
```
For example:
Obsidian Publish doesn't support embedded search results. To see the example, open Obsidian Help locally inside Obsidian.
embed OR search