# Subsections in org-roam buffer by tag search

**URL:** https://org-roam.discourse.group/t/subsections-in-org-roam-buffer-by-tag-search/3267
**Category:** How To
**Created:** [October 28, 2023, 1:08am UTC](https://org-roam.discourse.group/t/subsections-in-org-roam-buffer-by-tag-search/3267 "2023-10-28T01:08:33Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![vcurdia](https://avatars.discourse-cdn.com/v4/letter/v/f6c823/32.png) [@vcurdia](https://org-roam.discourse.group/u/vcurdia)
#### Post date: [October 28, 2023, 1:08am UTC](https://org-roam.discourse.group/t/subsections-in-org-roam-buffer-by-tag-search/3267/1 "2023-10-28T01:08:33Z")

</div>

I have been using org-roam for several months and a few times I tried out using Obsidian instead. The one thing about Obsidian that I like is how easy it is to use dataview to query the notes’ database and extract all the notes with a given tag or property. You can do this globally or for a given file’s backlinks. For example I can set one section that looks for all backlinks that have my journal tag, or all the backlinks that are bib items (also using tag), and finally another section for all remaining backlinks.

Another example is to have files for contacts all linking to the node of their organization, and then in the organization node show all the people that link to it but in org-roam it all comes mixed with other backlinks, so I’d like to be able to filter it by tag.

That said I still prefer org-roam over obsidian, despite this issue and the limited functionality on mobile (iOS).

My question is in the Org-roam buffer for a given node, how can I rearrange it to use tags’ search to separate the backlinks, to help organizing them. I know that we can add the reflinks section, but that’s it as far as I know how. I also know that it’s possible to query the database but I still haven’t figured it out for either showing in some sort of dynamic blocks in the org file (like Dataview in Obsidian) or in the org-roam buffer.

An alternative is if there is a way to open the org-roam buffer and filter what’s being shown interactively. But I don’t know how to do this either.

Any suggestions?

---

<div class="post-metadata">

### Author: ![nobiot](https://yyz2.discourse-cdn.com/free1/user_avatar/org-roam.discourse.group/nobiot/32/159_2.png) [@nobiot](https://org-roam.discourse.group/u/nobiot)
#### Post date: [October 29, 2023, 9:05am UTC](https://org-roam.discourse.group/t/subsections-in-org-roam-buffer-by-tag-search/3267/2 "2023-10-29T09:05:29Z")

</div>

I am not sure if I understand how Obisidian’s dataview works, perhaps

`org-roam-dblocks` or `org-roam-search` in [GitHub - chrisbarrett/nursery: Programs and libs that I haven't gotten around to formally packaging](https://github.com/chrisbarrett/nursery) by Chris Barrett might be useful for what you are trying to achieve. I don’t use them but it seems his features support tag search.

---

<div class="post-metadata">

### Author: ![nobiot](https://yyz2.discourse-cdn.com/free1/user_avatar/org-roam.discourse.group/nobiot/32/159_2.png) [@nobiot](https://org-roam.discourse.group/u/nobiot)
#### Post date: [October 29, 2023, 9:08am UTC](https://org-roam.discourse.group/t/subsections-in-org-roam-buffer-by-tag-search/3267/3 "2023-10-29T09:08:15Z")

</div>

> [@vcurdia](#):
>
> show all the people that link to it but in org-roam it all comes mixed with other backlinks,

Alternatively, the way @d12frosted does for linking to people/contacts might be a way to achieve what you are going for: [Boris Buliga - Task management with org-roam Vol. 6: Select a person and view related tasks](https://d12frosted.io/posts/2021-01-24-task-management-with-roam-vol6.html)

---

<div class="post-metadata">

### Author: ![vcurdia](https://avatars.discourse-cdn.com/v4/letter/v/f6c823/32.png) [@vcurdia](https://org-roam.discourse.group/u/vcurdia)
#### Post date: [October 30, 2023, 6:03am UTC](https://org-roam.discourse.group/t/subsections-in-org-roam-buffer-by-tag-search/3267/4 "2023-10-30T06:03:54Z")

</div>

Thanks. This actually looks promising. However, I tried to use org-roam-search but the installation instructions failed when I tried to do it from melpa. and when doing from local folder I get a message that cannot find async. I’ll try another time.

---

<div class="post-metadata">

### Author: ![nobiot](https://yyz2.discourse-cdn.com/free1/user_avatar/org-roam.discourse.group/nobiot/32/159_2.png) [@nobiot](https://org-roam.discourse.group/u/nobiot)
#### Post date: [October 30, 2023, 6:39am UTC](https://org-roam.discourse.group/t/subsections-in-org-roam-buffer-by-tag-search/3267/5 "2023-10-30T06:39:55Z")

</div>

> [@vcurdia](#):
>
> when doing from local folder I get a message that cannot find async.

If you look at the first code part of the source, you will see this:

```auto
;;; Code:

(require 'async)
(require 'dash)
(require 'magit-diff)
(require 'org-roam)
(require 'org-roam-review)
(require 'pcre2el)

```

You need all of them to be part of your Emacs.

---

<div class="post-metadata">

### Author: ![vcurdia](https://avatars.discourse-cdn.com/v4/letter/v/f6c823/32.png) [@vcurdia](https://org-roam.discourse.group/u/vcurdia)
#### Post date: [October 31, 2023, 9:32am UTC](https://org-roam.discourse.group/t/subsections-in-org-roam-buffer-by-tag-search/3267/6 "2023-10-31T09:32:43Z")

</div>

Thanks for bringing this up. The following setup seems to be working, as well as installing ripgrep in my machine.

```auto
(add-to-list 'load-path "~/.emacs.d/chris-barrett-nursery/lisp")
(use-package org-drill)
(use-package ts)
(use-package pcre2el)
(use-package org-roam-review
  :ensure nil)
(use-package org-roam-search
  :ensure nil
  :commands (org-roam-search))
(use-package org-roam-links
  :ensure nil
  :commands (org-roam-links))
(use-package org-roam-dblocks
  :ensure nil
  :hook (org-mode . org-roam-dblocks-autoupdate-mode))

```

I guess that the only issue is that this will possibly not work on my windows work machine because of the lack of ripgrep.

But in my research ubuntu machine this is working well.

It’s nice to get a list of all journal entries in a dynamic block in some notes, much like Dataview in Obsidian.  
here is the code I use for that, in case anyone is interested:

```auto
* Journal
#+begin: backlinks :tags journal
#+end:

```

then move the cursor to the block and hit C-c C-c to update. Pretty cool.  
Thanks @nobiot

---

<div class="post-metadata">

### Author: ![ahmed-shariff](https://yyz2.discourse-cdn.com/free1/user_avatar/org-roam.discourse.group/ahmed-shariff/32/1306_2.png) [@ahmed-shariff](https://org-roam.discourse.group/u/ahmed-shariff)
#### Post date: [November 2, 2023, 2:57am UTC](https://org-roam.discourse.group/t/subsections-in-org-roam-buffer-by-tag-search/3267/7 "2023-11-02T02:57:06Z")

</div>

I had written org-roam-ql, which might be of interest to you [GitHub - ahmed-shariff/org-roam-ql: Query language for org-roam](https://github.com/ahmed-shariff/org-roam-ql)

---

<div class="post-metadata">

### Author: ![Win36](https://avatars.discourse-cdn.com/v4/letter/w/e0b2c6/32.png) [@Win36](https://org-roam.discourse.group/u/Win36)
#### Post date: [November 2, 2023, 7:34am UTC](https://org-roam.discourse.group/t/subsections-in-org-roam-buffer-by-tag-search/3267/9 "2023-11-02T07:34:38Z")

</div>

Wow this looks amazing! Great work! Thank you
