# Search and filters

Search finds documents and Sourcebook pages by name or by what they say, and filters narrow the results by type, campaign, session or a property you choose.

## Opening search

Press ⌘K on a Mac, Ctrl+K elsewhere, or click **Search** at the top of the sidebar. `/` opens it too when you aren't typing in a document.

Search covers every file in your workspace and every page of the [Sourcebooks](https://dunjii.com/docs/organizing/sourcebooks.md) you have turned on. With nothing typed, it lists the files you opened most recently.

It also finds places in the app. Type `trash`, `billing` or `srd` and a **Go to** row opens Deleted files, Plan & usage or the D&D SRD 5.2.1. Type dice such as `2d6+3` and a **Dice** row rolls them when you press ↵.

| Key        | What it does |
| ---------- | ------------ |
| ↑ ↓        | Move through the results. |
| ↵          | Open the result. |
| ⌘↵         | Open it in a new tab. |
| ⇧↵         | Pick it. See [Picking results](#picking-results). |
| Tab        | Add the filter that search offers, or jump to the next list of results. |
| ↑ in the search box | Bring back an earlier search that starts with what you've typed. This browser keeps your last 25. |
| esc        | Close search. |

On Windows and Linux, press Ctrl where this page says ⌘.

## Names and contents

Results come in two lists. **File names** matches what you type against each document's name and folders, so a few letters of a name are enough. When two files match equally well, the one nearest the page you are on comes first.

**In file contents** searches the text inside your documents once you have typed two characters, and shows the passage that matched. It matches whole words. Put a phrase in quotes ("silver key") to match it exactly, and put a minus before a word (-goblin) to leave out documents that contain it. Your own documents come before Sourcebook pages, and a document already listed under **File names** isn't repeated.

If a word of six or more letters matches nothing, search tries the closest word in your files, up to two letters different, and says which word it used.

The right side of the window shows the selected result as it looks on the page.

![Results for bell: matching names first, then documents that mention it.](https://dunjii.com/docs-assets/organizing/search-results.webp)

## Filters

The row under the search box holds filters. **Type**, **In** and **Session** are on it whenever there is more than one value to choose from. **In** narrows to one campaign or one Sourcebook. **All filters…** lists everything else you can filter on, such as a spell's level, school and classes or an item's rarity, with the number of matching files beside each value.

You don't have to open a menu. As you type, the row offers matching filters: typing `evoc` offers **School Evocation**, and Tab adds it. You can also type a filter as `key:value`, such as `type:spell`, and it becomes a chip. A level is a range: type `level:1-3`, or click two levels in the **Level** menu to choose everything between them.

Values of one filter are alternatives: **Classes Wizard or Druid** finds either. Different filters must all match, and the row puts **and** between them. Click a chip to change its values, click its × to remove it, or press Backspace in an empty search box to remove the last one.

![Three filters: evocation spells of levels 1 to 3 on the wizard list.](https://dunjii.com/docs-assets/organizing/search-filters.webp)

## Your own properties

A property you write in frontmatter yourself, such as `region:` or `faction:`, becomes a filter once you declare it. List it under `filterableProperties` in the `metadata.md` at the top of your workspace:

```markdown
---
filterableProperties: [region, faction]
---
```

- `filterableProperties: [region, faction]`: Only the metadata.md at the top of the workspace can set this.

```markdown
---
type: npc
region: Mistwood
faction: [Ashen Court, Rivermen]
---
```

- `region: Mistwood`: Filter with region:mistwood, or find Region under All filters….
- `faction: [Ashen Court, Rivermen]`: A list gives the document both values.

You can also declare one from the editor. Open the document's **Settings** block: a property you can filter on has a funnel at the end of its line, labeled **Filter by Region everywhere**. Click it to add the property to `filterableProperties`, and click it again to remove it. Search picks it up at once for every document that has the property.

A value can be text, a number, true or false, or a list of those. Values that look like dates, links or file paths are skipped, as are values over 64 characters. Keys that Dunjii already uses, such as `type`, `theme` and `print`, and the filter names `in` and `session` can't be declared.

![The funnel beside region: Mistwood in a document's settings.](https://dunjii.com/docs-assets/organizing/search-property-funnel.webp)

## Picking results

Press ⇧↵ or click the checkbox at the left of a row to pick it. ⇧-click picks every row between the last pick and the one you click. Once you have picked something, a plain click picks or unpicks a row, and the bottom of the window counts your picks.

With rows picked you can:

- drag them to a folder in the sidebar, which moves your own files and copies Sourcebook pages;
- press ⌘C to copy them, then **Paste** them into a folder;
- press Delete (⌫ on a Mac) to delete them.

Right-click a picked row for the same actions, plus one that makes a sheet when every pick is the same kind of thing: **Create card sheet from 2 cards…** for spells, items and abilities, and **Create coin sheet from 2 pictures…** for pictures. The number matches your picks. See [Card sheets](https://dunjii.com/docs/layout-and-printing/card-sheets.md). Right-click a single row for **Open in new tab** and **Copy link**, or a folder for **Info**.

![The menu for two picked spells.](https://dunjii.com/docs-assets/organizing/search-picked-menu.webp)
