Help with search

Hello helpful and awesome Obsidian users,

Here is my scenario:

  1. I have some notes about “Java” - some related notes around this are “code snippets”, and some others are “design” related.
  2. Similarly, I also have some notes about “Haskell” - some related notes around this are “code snippets”, and some others are “design” related as well.

When I take these notes, the most logical way (in my mind) to takes these notes is something like:

  1. I create a page called “Enums”, and have [[Java]] [[Code Snippets]] as links in there.
  2. I create another page called “Singletons” and have [[Java]] [[Design]] as links in there.
  3. Likewise, I create another page called “List Comprehension” and have [[Haskell]] [[Code snippets]] as links in this page.

What I want to achieve:

  1. I want to be able to search for all notes that are linked to [[Code Snippets]] and only for [[Java]] and not [[Haskell]]. What should I search for, in the search command? To be clear, I want to do something like [[Code Snippets]] AND [[Java]] and I want to be able to see my “Enums” page but no pages related to Haskell.

Note:

  1. I understand that I can do this by pulling up a local graph for [[Code Snippets]] and then filtering on [[Java]] - a two step process. Given I’d have to do this frequently, I am looking for a quicker way to do this on the search (Cmd + Shift + F).
  2. Also understand that I can do this by changing the links such that instead of [[Design]], I have a dedicated [[Java Design]] and [[Haskell Design]] instead. This will work, but it sort of suffers from two issues (IMHO) - umm, it does not “feel” elegant, but more importantly it is restrictive in a few ways. For example, this mechanism does not allow me to tag those pages with [[Design]] that may be around the design reviews I do for my work, and not necessarily around Java or Haskell. I’d rather have a way to search for [[Design]] and (say) [[Work]] to get this done, instead of creating yet another (sort of non-sensical) page called [[Work Design]].

All in all, I guess what I am trying to figure out is, given a couple/few [[links]] how do I find those pages that have a (set) intersection of these links. Would really appreciate some help and I am sorry if this is very basic and I am the only one not able to figure it out (I did go thru the search section on Obsidian help and may be regex is one way to do this, but looking for something simpler/intuitive).

I believe this will do the job:

"[[Code Snippets]]" [[Java]] -[[Haskell]]
3 Likes

Hello @macedotavares - that worked like a charm. Thank you (yet again) for your help! P.S. Also embarrassed about how did I miss the obvious (and was looking all over the place to find a solve for this for the last couple of days!)

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.