Allow searching for filenames including extension

Hello,

Today, when searching for a file abc.pdf, I have to search for abc in order to be able to find it for sure (sometimes it also works with the extension, but many times it doesn’t). I think the filename with the extension should be indexed and searchable by default.

(In my case, I’m mainly searching for files that were attached to emails and that have been added to the database through the new option of importing attachments. Maybe that’s specific to this situation, but even in that case I think the filename with extension should be indexed.)

Have a great day!

Please provide a screen capture.

There’s a dedicated condition for filenames, see advanced search or filename prefix.

Of course, here you go. With the extension:

Without:

And when I select one of the files, the result is:

The same happens with this jpg for instance. Without extension:

With extension:

Indeed, when I add the filename condition, it works, but it’s perfectly counterintuitive that when searching with the “all” option I don’t find my file, and when I “restrict” to a certain field, I find it:

As is well documented, you should be specific in your searches by employing search prefixes. @cgrunenberg has already mentioned the filename: prefix and search option.

filename: expects the exact name, including the extension.
filename:~ uses the contains operator and allows substring matching.

@cgrunenberg: filename doesn’t include the matches operator. Is that expected?

It’s certainly well documented, but I cannot understand the logic behind it. There’s a big search field inviting me to search, and it often works, but in some cases I have to restrict my search to get more search results? I’m sure there’s a logic to it, but it’s not intuitive for me.

In that case, I would suggest renaming “All” (Alles in German) in the following screenshot to be more specific, since it’s not searching in all, but only a subset:

grafik

Yes, filenames aren’t indexed.

1 Like

It’s about precision and best practices. Just as using good diction makes communication more effective, being specific in searches is also more effective. Making assumptions the software will know what you want or being imprecise in your searches leads to false positives and having to sift through unwanted results. So if you know you’re looking for words in a name, use name: or filename:. If you are looking for words in the body of a document, use text: or content:, etc. This also becomes more important as your databases grow.

So there’s “the logic behind it” :wink:

Thank you, @BLUEFROG and @cgrunenberg for taking the time to reply. At first, I was slightly disappointed, and thought of leaving it there. However, since I think you built and are continuing to improve a really brilliant product, I thought it is worth responding once more.

@BLUEFROG, I perfectly understand the logic of using search operators when knowing what to look for.

For my use cases, there are situations where this is not ideal. For instance, if I stumble on a file somewhere in my archive, and want to understand where it came from, what’s its context. Ideally, I’d like to copy its filename (with the extension, since I want to be specific and don’t want to find other files that have the same name but not the same extension), search for it in DT, and understand how I used it in the past, who sent it to me, etc. The current working of DT makes it nearly impossible. If I paste the filename of an attachment into DT, it will not be found in the two places I’d expect it:

  1. As an individual item (if I have imported it separately). Because of the reasons mentioned above, and “everything” not really meaning everything.
  2. Inside the email, because names of attachments are not indexed.

That makes it hard if not close to impossible to get an overview of the context of the message.

It’s also confusing, since “everything” is supposed to look in all the fields, but apparently it doesn’t. Of course, you could rename “everything” to something closer to how it really works, but I believe it’s more intuitive to have it effectively look in all fields by default. That’s how most search functions work on the Mac and on the web.

A last suggestion, but very minor one: when searching for the filename with the correct options activated, the “search closeness” indicator should, if I understand it right, show a high degree of correlation if the filenames match exactly (which is the case in the screenshot below). Today, it shows a very low degree of correlation:

Thank you for making such a great tool, and all the best!

As an individual item (if I have imported it separately). Because of the reasons mentioned above, and “everything” not really meaning everything.

While being specific is recommended, what you said is definitely not impossible…

But as discussed already, the filename in an email isn’t indexed in a way to locate it. That’s something development has to assess and decide.

but I believe it’s more intuitive to have it effectively look in all fields by default. That’s how most search functions work on the Mac and on the web.

Search functions on a Mac don’t account for all the possibilities. In fact, there’s a ton of metadata that is available but not used…

And “on the web” doesn’t deal with the amount of metadata DEVONthink does.

1 Like

Oh, I didn’t know that, thank you for pointing it out. In any case, searching for filenames works in Spotlight and Finder by default, without any other necessary action from my side. Since DT is so much more powerful, I would have expected it to work in DT, too, by default.

I don’t understand your first image. It shows a search with extension that leads to a result. In my case, the attachments extracted by DT don’t have the extension in the name.

Anyway, I mainly wanted to provide you with a data point in your user research. It’s your product, you decide!

All the best

Is General > Appearance > Show filename extensions disabled? Note that would only affect the display but not the search results.

Oh, good to know. Now they appear, that’s nice.

It doesn’t change the search results, though: without the filename== prefix, I don’t get any result, and the search results are still “yellow” when I add the prefix

I’m adding a +1 user voice for that. :slight_smile: :ballot_box:

I’m following this thread only from the sidelines, but when trying what is suggest here, some files are not found. E.g. “Scan_20250707_124226_000223.pdf”

If I search for it with filename:Scan_20250707_124226_000223.pdf, nothing is found (see screenshot). I’ve turned on the extensions for filename in the preferences, BTW.

Now, I use filename<:Scan_20250707_124226_000223 and the file is found:

I’m probably misinterpreting what was said before, but shouldn’t filename==… with the extension find the filename, especially if filename<:… finds the first part of it?