Jump to content
ioemilio

Ignore Specific Extensions in File Search

Recommended Posts

It would be great if one could exclude from all search results files with a specific extension.

 

There are files in my Documents folder that I never want to look for, e.g., compiled files such as byte code for Python classes (.pyc), Java libraries (.jar), Java compiled classes (.class), automatically generated web pages (.html files) and so on.

 

 

 

I guess adding an option that hides files with some user-specified extension from Alfred search results should not be hard to implement (also in a second step, i.e., it is not necessary to exclude them from Alfred index, but just hide them a posteriori in the search results if specified). I think users could benefit from this, having personalized search results. 

Share this post


Link to post
Share on other sites
Posted (edited)

Can't be done, I'm afraid.

 

Alfred doesn't maintain its own index: it uses the macOS metadata search API, which is "whitelist-only". There's no (reasonable) way to exclude specific types of files or directories beyond adding them to the Privacy pane in Spotlight's settings. Your only realistic option is to create a File Filter that explicitly only searches .py and .java files.

 

This has been requested several times before, but it has been rejected on performance grounds. The main issue, as I understand it (which is not well), is that the metadata search returns lightweight "pointers" to results, rather than all the metadata, and Alfred would have to pull in the full metadata in order to do its own filtering, which could lead to horrendously slow performance in pathological cases (node_modules, I'm looking at you…)

 

Perhaps @Andrew has reconsidered now that Macs are a lot faster than they were years ago?

 

On 5/16/2019 at 3:16 PM, ioemilio said:

compiled files such as byte code for Python classes (.pyc), Java libraries (.jar)

 

Look on the bright side: At least you're not a Node developer. Not being able to blacklist node_modules makes Alfred (and Spotlight) more or less useless for searching within your projects. Also, you don't have to deal with JS…

Edited by deanishe

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...