Ability to filter (in Search and Graph) by Internal Links

Use case or problem

This seems like it would be very easy but I haven’t figured out how to do it in either vanilla or plugin Obsidian.

I’m looking at: Search - Obsidian Help

I’m looking for the ability to filter (in Search and Graph) by internal links, in other words, by graph structure (i.e. “locality/connectivity/mentioning”).

Specifically, I want to filter (in either Obsidian’s search or in a graph view) by only files which have a connection with a certain file example.md. What can I use to do this?

So I basically want to search for all files which would appear local to a file in its local graph.

Check out the following setup:
demonstration via a screenshot shared over Discord

  • I don’t like the filter [[example]] because example.md has an alias exampletron, and filtering by [[example]] doesn’t come up with connections by way of the content [[example|exampletron]].
  • I don’t like the filter [[example|exampletron]] because that doesn’t include connections by way of the content [[example]].
  • I’ve strongly considered using the filter [[example, which would come up with connections by way of either content [[example]] or [[example|exampletron]]. However, it still brings up results by way of the content [[example junk]] for another file example junk.md, which I am not currently interested in.
  • The filter file:(example) only brings up example.md itself, which is not what I want. I want all files connected to example.md (not including example.md).
  • The best filter I’ve come up with so far is the filter [[example]] OR [[example|exampletron]]. However, this quickly becomes tedious to add a lot of “OR” cases for every alias.
  • The local graph feature is notably similar to what I’m looking for. However, that only works for one file. If I want a cross-section of files connected with both example.md and, say, a combo.md, I can’t simply view a local graph. It also doesn’t help when I want all files connected with either example.md or combo.md.
  • The backlinks feature is notably similar to what I’m looking for, yet has the same issue as the local graph feature.

Proposed solution

It feels like we need a new filter feature: mentions:"example". Which would catch all content of the form [[example]], [[example|exampletron]], and so on for any other aliases.
To go along with this, there also ought to be a ‘mentioned-by’ filter. This would correspond to the ‘mentions’ filter in the same way that Obsidian’s outgoing links feature corresponds to Obsidian’s backlinks feature.
For the ‘mentions’ filter feature, one could potentially put an “AND” in between repetitions of ‘mentions’ calls to select a cross-section of notes which mention the subject of each repetition. And one could potentially put an “OR” in between repetitions of ‘mentions’ calls to select those notes which mention any of the subjects of the repetitions. However, it could be even easier if two more filter features were introduced, which accepted an array of markdown file names, to streamline the syntax:

  • mentions-any-of:example1,example2,example3
  • mentions-all-of:example1,example2,example3
    And the same two additional filters could correspondingly be added for ‘mentioned-by’ plural logical operations:
  • mentioned-by-any-of:example1,example2,example3
  • mentioned-by-all-of:example1,example2,example3
2 Likes