epwalsh / epwalsh/obsidian.nvim

Be able to search based on multiple tags instead of one.

Open
#642 1 comment 2 reactions 0 assignees View on GitHub
feature request
Dominant language
Lua
Stars
6.2k
Forks
250
PR merge metrics
No merged PRs in 30d

Description

### 🚀 The feature, motivation and pitch

Currently we can use `:ObsidianTags` to search for files with certain tags attached to them.
This is handy if the number of files that match a specific tag is not that high, but what if your tag is added to a big number of files?
Then it may be handy to reduce the number of possible file options by adding another tag, or even multiple other tags, to search for in your files.

Say I have 2 files with the following frontmatters:

**file 1**
```markdown
---
id: Obsidian Todo
aliases: []
tags:
- todo
- obsidian
---
```

**file 2**
```markdown
---
id: Obsidian how-to
aliases: []
tags:
- how-to
- obsidian
---
```

Now say we want to find file 2, if we search for 'obsidian' with `ObsidianTags` we will retrieve 2 files from which we can pick, now imagine you have not 2 files with the tag 'obsidian' but 100 files, then you would still have to scroll through all the entries to find the note that you want.
It would be good to refine your search result with another tag, like 'how-to' or 'todo' here.

- We could make use of the same telescope menu, and use a different mapping to 'store a tag' as a search tag (it would be nice if these could be listed somewhere in the telescope window, but not required).
- after storing a tag, the telescope window should refresh and only show the possible tags from that point onward, so in our previous example, if you would start with 'obsidian' as your stored tag, then the window should refresh and only should show 'how-to' and 'todo' as possible options since these are the only two tags that overlap in the files where 'obsidian' is also a tag.
- finally after pressing enter your search result should come up which shows the possible files that contain all the stored tags.

### Alternatives

_No response_

### Additional context

_No response_

Contributor guide

Open the contributing guide

Research direction

Start by reading the existing `:ObsidianTags` Telescope picker and its tag-result flow. Confirm how a tag is selected and how matching files are returned; done means users can retain multiple tags, see only overlapping tags after each selection, and receive files containing all selected tags.

Written by the indexing model from the issue text.

Assessment

Tech stack
lua
Domain
search
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.