Can't search for a file/note based on its alias

Steps to reproduce

  • Create a new file/note. Title it anything.
  • Add an alias to that file.
  • Search for that file using the alias as - file:alias where alias is the alias.

Expected result

I expect the file with that alias to be shown in the search results.

Actual result

Search results doesn’t show that particular file/note

Environment

  • Operating system: Windows 10
  • Obsidian version: v0.12.19 (behavior existed in previous versions as well)

Additional information

The image below is when I try to search for the file/note by its name.

It shows up in the result as expected.

When I try to search for the file using its alias –

The search results are blank.

I tried to find this in the forums using some of the search words like alias search, but couldn’t find anything relevant. Sorry if I missed this. I don’t know if this is intentional design, a bug, or it could potentially be a feature request. But it could help as per me. Especially when there are a lot of files and you don’t quite remember whether the title is the file name or the alias.

1 Like

Why do you need to use the “file:” search? I suspect that goes literally on the saved file name, only. However, if you just search for “abcde” (i.e. without using the “file:” prefix, you will get your file listed.

I just tried to create a new file, which I saved as “Test 2” and has an alias “Very Cool File Name”. Just searching a generic search for “very cool file name” will find Test 2.md. Searching with the “file:” prefix will not dig it out, as it isn’t even looking in the metadata for the files, only the literal name of the file.

To me the above makes sense and I don’t see it as a bug. I would say it is using unnecessary user-based specificity, and just like you won’t get the file if you use the “tags:” prefix, or the “path:” prefix, as it only looks for tags/paths, you will not get it listed with “file:” prefix as it only looks for file names, which isn’t either what you are actually looking for. If you are a little bit less specific and skip any special prefix it will get listed though.

Just IMHO of course. :slight_smile:

This is an interesting report. I see your point. Not sure if it’s BR or FR. Anyway, we’ll think about this.

try this
line:(aliases: your alias name)