Search documentation may be incorrect re: default AND

What I’m trying to do

Hi, I am trying to find files with both A and B strings in them.

Things I have tried

This regexp does what I want:

/\- \[ \].*\#todo\/wip.*/

Incomplete todo item with “#todo/wip” tag.

If I were to search for “task-todo:(#todo/wip)” I would also get the correct result.

However, what if I wanted notes with “todo” and “wip” in them? Not tags, just these strings.

This search “todo wip” should, according to the documentation, create an implicit AND between “todo” and “wip” and return documents that contain both terms. This is different from “todo OR wip” in that this search would return documents that had one word or the other in them (and those with both, of course).

In fact (for me, anyway), the search “todo wip” returns “todo OR wip” results.

Can anyone explain to me if I am reading the docs wrong? And if I am, short of using a regexp, is there a way to do an “AND” search?

Here are the docs, for reference: Search - Obsidian Help

You can control whether to return files that contain all the words in your search term, or any of the words:

  • meeting work returns files that contain both meeting and work.
  • meeting OR work returns files that contain either meeting or work.
2 Likes

A search for todo wip will match any file containing both words, but the search previews will show each match of either word. If you collapse the results to show only the file names, I think you’ll find that all of the files listed contain both words (this is of course easiest to check with a small set of results). Is that what you’re seeing?

2 Likes

Don’t know if this is relevant, but searching for todo wip will also find words like todos, wipe, swipe, wiper, wipeout, which you can see in the screenshot below.

A restrictive search yields more precise results: "todo" "wip"

1 Like

I feel this comes up every few months and always forget how it works. :cry:

I’ll just leave these here for now.

2 Likes

This could be it. I have confirmed it works like this in my work vault. I guess I was assuming any snippet relevant to the results would be present in the preview but I an see how that would be problematic if a word appeared a hundred times in a note, etc.

If I can confirm later in my other vault (the one I am using these searches in) I will update here despite feeling like an idiot for not realizing this.

You are 100% correct and I proved it to myself with a simple example. I’m a little embarrassed but I’ll get over it.

You’re not the first! It can be a little confusing. Perusing the links ariehen posted may soothe your pride. :wink:

1 Like

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