# Org-roam-node-find sorting unexpectedly!

**URL:** <https://org-roam.discourse.group/t/org-roam-node-find-sorting-unexpectedly/1840>\
**Category:** How To\
**Created:** [July 28, 2021, 1:36am UTC](https://org-roam.discourse.group/t/org-roam-node-find-sorting-unexpectedly/1840 "2021-07-28T01:36:09Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![harizvi](https://avatars.discourse-cdn.com/v4/letter/h/ce7236/32.png) [@harizvi](https://org-roam.discourse.group/u/harizvi)\
**Post date:** [July 28, 2021, 1:36am UTC](https://org-roam.discourse.group/t/org-roam-node-find-sorting-unexpectedly/1840/1 "2021-07-28T01:36:09Z")

</div>

I’m on org-roam v2. I was expecting that the org-roam-node-find will show docs in sorted mtime order, because org-roam-node-default-sort is set to file-mtime by default.

I can see in the sqlite3 database that the nodes data is correct and up to date. I can edit a file / node, and its data is updated correctly.

The org-roam-node-find shows docs, which seem to be somewhat sorted by tags (empty tags, numeric tags, and then alphabets). Not all docs with no tags show at the top.

I’ve done a complete org-roam-db-clear-all and rebuilt the database.

---

<div class="post-metadata">

**Author:** ![harizvi](https://avatars.discourse-cdn.com/v4/letter/h/ce7236/32.png) [@harizvi](https://org-roam.discourse.group/u/harizvi)\
**Post date:** [July 30, 2021, 11:28pm UTC](https://org-roam.discourse.group/t/org-roam-node-find-sorting-unexpectedly/1840/2 "2021-07-30T23:28:44Z")

</div>

Would love to get some responses with what others are seeing, just to determine if it is common, or some issue with my setup.

Does your org-roam-node-find show nodes strictly in modification time order?

---

<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:** [July 31, 2021, 7:40am UTC](https://org-roam.discourse.group/t/org-roam-node-find-sorting-unexpectedly/1840/3 "2021-07-31T07:40:20Z")

</div>

No. It seems that modification time is adjusted by the alphanumeric order of what appears in each line in minibuffer.

I haven’t looked into this in detail but that’s the impression I get.

I suspect this varies from a completion framework to another; e.g. the resultant order seems to differ between Ivy and Vertico. I guess it can be further modified by histsave and other modes (prescient?) that influence the order if you have any turned on.

---

<div class="post-metadata">

**Author:** ![harizvi](https://avatars.discourse-cdn.com/v4/letter/h/ce7236/32.png) [@harizvi](https://org-roam.discourse.group/u/harizvi)\
**Post date:** [July 31, 2021, 6:53pm UTC](https://org-roam.discourse.group/t/org-roam-node-find-sorting-unexpectedly/1840/4 "2021-07-31T18:53:19Z")

</div>

nobiot, thanks for confirming. You are right that different frameworks show (slightly) different order of results. I see differences between selectrum and vertico.

It’s not a big issue, but it will be good to have a definitive way to get results in modification time order.

---

<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:** [July 31, 2021, 8:46pm UTC](https://org-roam.discourse.group/t/org-roam-node-find-sorting-unexpectedly/1840/5 "2021-07-31T20:46:11Z")

</div>

> [@harizvi](#):
>
> definitive way

Given that different completion frameworks seem to modify the completion-table, it would be specific to your completion framework of choice.

I think you would need to study how your completion and your config do it in detail.

I am reasonably happy with how mine is at the moment.

---

<div class="post-metadata">

**Author:** ![harizvi](https://avatars.discourse-cdn.com/v4/letter/h/ce7236/32.png) [@harizvi](https://org-roam.discourse.group/u/harizvi)\
**Post date:** [July 31, 2021, 11:32pm UTC](https://org-roam.discourse.group/t/org-roam-node-find-sorting-unexpectedly/1840/6 "2021-07-31T23:32:40Z")

</div>

Yes, I’ll try out the various completion frameworks. On a quick look, ivy-mode listing seems closest to file-mtime. Thanks.
