Unlinked Mentions: longest match to the same note only / don't show substring matches

For notes with aliases, if the same text elsewhere matches multiple aliases due to one of them being a substring of another, this feature request asks Obsidian only show the longest full match, or provide some workaround to avoid multiple duplicates: either show the longer one by default, or provide an option to only suggest the longest match.

Example below tl;dr Notes with alias AABB and BB, when I write “AABB” elsewhere, Obsidian currently would suggest both “AABB” and “BB” (partial match) as links to that note. But “BB” alone should not be in the unlinked mention suggestion, it should only contain “AABB”.

Use case or problem

Background: I rely heavily on the unlinked mentions feature to discover links to other notes from daily notes instead of manually linking them. I would focus on just writing things down throughout the day in my daily note, and at the end of the day link everything by clicking the suggestions in the outgoing unlinked mentions panel.

Right now the behavior of Obsidian is to match for all aliases of the same note, and present all of them in some random order. This feature request is asking for an option to only suggest the longest full match for any specific note. Here’s an example:

Example

Assume I have a project called “Dragonfly”, I might have a project note project-dragonfly.md with the following content:

---
title: Project Dragonfly
aliases:
- Dragonfly Project
- Dragonfly
- Project Dragonfly
---

# Project Dragonfly
Multiple aliases above are for better discoverability (or better unlinked mention suggestions).

Now this file is discoverable by Obsidian with all of the following keywords:

  • Dragonfly
  • Project Dragonfly
  • Dragonfly Project
  • project-dragonfly (filename)

Assume now I write something in the daily note or anywhere else:

- 2022-03-02 17:47: worked on Project Dragonfly for 1 hour.

In the Outgoing Links → Unlinked Mentions panel, that would create two suggestions:

But there seems to be no reason for the second suggestion (only link Dragonfly and leave the Project) to exist. This would require additional attention / mental power while choosing amongst the unlinked mentions suggestions, with all those duplicate yet useless items.

In my use case, half of the items in the outgoing unlinked mentions are duplicates / substrings of the ones that I actually want to link, and I have to pick and skip them every day. The is especially painful in some non-latin languages like Chinese, where there’s no spacing between words, and no semantic word tokenization is done from Obsidian (could be another feature request).

Proposed solution

When we have two or more potential mentions (say AABB and BB) to the same note due to aliasing, we do an additional check to see if one is a superset of another (say AABB includes BB as substring), and only present the longer one (in this case AABB).

Current workaround (optional)

There’s no workaround really, I just have to waste some time to carefully choose among all those options to manually pick the full match.

Related feature requests (optional)

This feature (includes alias in unlinked mentions) was introduced in Obsidian Release v0.9.16 .