Jump to content

Alfred is searching directories I don't want


Recommended Posts

When I want to launch a particular application - I start to type the name in to Alfred - it finds the app I want, but it also finds that app in several Virtual Machine images I have on my machine. 

 

How do I tell Alfred not to search for files/applications in particular directories?

 

SEarch Scope seems to ask you which directories to include, but not exclude.  Include folders in Home is checked but it is actually one of those subfolders two levels down from Home I want to exclude.

Link to comment

When I want to launch a particular application - I start to type the name in to Alfred - it finds the app I want, but it also finds that app in several Virtual Machine images I have on my machine. 

 

How do I tell Alfred not to search for files/applications in particular directories?

 

SEarch Scope seems to ask you which directories to include, but not exclude.  Include folders in Home is checked but it is actually one of those subfolders two levels down from Home I want to exclude.

 

Drag the folders containing the applications you don't want searched to OS X's spotlight privacy prefs, wait a few moments, then type 'reload' in Alfred. They will then disappear from Alfred's results :)

Link to comment
  • 5 months later...

I'm having a similar problem (loads of stuff showing up in Alfred that I don't want showing up in Alfred), but excluding the relevant folders from Spotlight is not an option. For one thing, there are dozens and dozens of folders (my Sublime Text 2 plugins for example), and for another, I often use Spotlight to search those files.

 

Can't Alfred have its own blacklist? Preferably with wildcard support, much like .gitignore.

 

Piggybacking Spotlight's preferences is sub-optimal simply because Alfred isn't Spotlight. I use Spotlight all the time to search large file trees that I really don't want showing up in Alfred (source code, usually), not least because Alfred only shows the first few results of a search, so the stuff I'm looking for gets dropped on the floor.

 

Being able to add, for example, "*.py" to an Alfred blacklist would make Alfred a lot more useable without breaking Spotlight.

Edited by deanishe
Link to comment

I'm having a similar problem (loads of stuff showing up in Alfred that I don't want showing up in Alfred), but excluding the relevant folders from Spotlight is not an option. For one thing, there are dozens and dozens of folders (my Sublime Text 2 plugins for example), and for another, I often use Spotlight to search those files.

 

Can't Alfred have its own blacklist? Preferably with wildcard support, much like .gitignore.

 

Piggybacking Spotlight's preferences is sub-optimal simply because Alfred isn't Spotlight. I use Spotlight all the time to search large file trees that I really don't want showing up in Alfred (source code, usually), not least because Alfred only shows the first few results of a search, so the stuff I'm looking for gets dropped on the floor.

 

Being able to add, for example, "*.py" to an Alfred blacklist would make Alfred a lot more useable without breaking Spotlight.

 

Alfred doesn't piggyback Spotlight's preferences... Alfred uses the OS X metadata api for file search and this only allows inclusions, not exclusions. This is why the easiest way to exclude things from Alfred is to just exclude them from the OS X metadata.

 

The best way to get Alfred's file search working most effectively is by thinking the other way around and what you WANT him to find, then create workflows which have file filters for these specific files. For example, I use keyword 'f' for searching for only folders in my home folder.

 

Cheers,

Andrew

Link to comment
  • 1 month later...

Thanks very much for the tip. That's certainly helped with a few cases, and definitely the most painful ones.

 

I'd still prefer a .gitignore-style ability to exclude things from Alfred without excluding them from the metadata index.

 

In the long run, it would save me a lot of time and effort not having to create a custom workflow for every search that throws up a lot of irrelevant stuff that I still want to access via Spotlight, HoudahSpot etc.

 

Sometimes a blacklist is just a much better fit than a whitelist.

 

For example: I have a directory tree of textbooks, articles, tests etc. that I'd like to be able search. There is one subdirectory containing OmniOutliner outlines, which is the only subdirectory and the only filetype I don't want to search.

 

Because I can't exclude either, I either have to add every single sibling folder to the search scope or every other conceivable filetype to the file filter.

Edited by deanishe
Link to comment

Thanks very much for the tip. That's certainly helped with a few cases, and definitely the most painful ones.

 

I'd still prefer a .gitignore-style ability to exclude things from Alfred without excluding them from the metadata index.

 

In the long run, it would save me a lot of time and effort not having to create a custom workflow for every search that throws up a lot of irrelevant stuff that I still want to access via Spotlight, HoudahSpot etc.

 

Sometimes a blacklist is just a much better fit than a whitelist.

 

For example: I have a directory tree of textbooks, articles, tests etc. that I'd like to be able search. There is one subdirectory containing OmniOutliner outlines, which is the only subdirectory and the only filetype I don't want to search.

 

Because I can't exclude either, I either have to add every single sibling folder to the search scope or every other conceivable filetype to the file filter.

 

I would love to be able to provide the ability to blacklist or ignore folders, but unfortunately, the OS X metadata search API only allows you to specify the folders you want to recursively search and no way to ignore folders.

 

To ignore folders, Alfred would either have to do the indexing himself, or to return every single matching search result and then remove the ones in the excluded folder trees (both of which would turn him into a heavyweight giant).

 

Either way, this is something I'm very aware of and review on a regular basis. If there is a way I can efficiently improve the file search in this way, I will.

 

Cheers,

Andrew

Link to comment

I would love to be able to provide the ability to blacklist or ignore folders, but unfortunately, the OS X metadata search API only allows you to specify the folders you want to recursively search and no way to ignore folders.

 

To ignore folders, Alfred would either have to do the indexing himself, or to return every single matching search result and then remove the ones in the excluded folder trees (both of which would turn him into a heavyweight giant).

 

Either way, this is something I'm very aware of and review on a regular basis. If there is a way I can efficiently improve the file search in this way, I will.

 

Cheers,

Andrew

 

I'm not really buying this. At least wrt excluding folders. That, at least, is a pretty trivial matter, especially compared to the things Alfred can already do.

 

I've been playing around with mdfind in Python and benchmarking filtering the results. Even in Python, filtering the results doesn't present much of a performance problem. At worst, applying 10 globbing patterns to 30,000 results took ~400% of the time of the original Spotlight search. Excluding 6 directories took 10% as long (0.05 seconds) as the original search. Considering Python's speed vs C, the globbing might be borderline, but excluding directories is a no-brainer.  It's also literally one line of code (at most 10 in a language without list comprehensions?). Implementing the GUI would be far more work.

 

Here's the code I used.

 

A means to exclude folders and filetypes both globally (I really don't want to see any source code in Alfred, for example) and in file filters would be, imo, a massive boost to Alfred's utility.

 

If you had one of those vote-for-features things, this would literally get all my votes. It's the only feature I would want to add to Alfred (except perhaps undo when deleting stuff in Workflows).

 

I've been mulling over what you said re "think in terms of what to include, not what to exclude", but in some situations, this is simply impossible wrt Alfred's global search, and massively impractical wrt file filters (including 100 folders/filetypes because I can't exclude 1).

Edited by deanishe
Link to comment

I'm not really buying this. At least wrt excluding folders. That, at least, is a pretty trivial matter, especially compared to the things Alfred can already do.

 

I've been playing around with mdfind in Python and benchmarking filtering the results. Even in Python, filtering the results doesn't present much of a performance problem. At worst, applying 10 globbing patterns to 30,000 results took ~400% of the time of the original Spotlight search. Excluding 6 directories took 10% as long (0.05 seconds) as the original search. Considering Python's speed vs C, the globbing might be borderline, but excluding directories is a no-brainer.  It's also literally one line of code (at most 10 in a language without list comprehensions?). Implementing the GUI would be far more work.

 

Here's the code I used.

 

A means to exclude folders and filetypes both globally (I really don't want to see any source code in Alfred, for example) and in file filters would be, imo, a massive boost to Alfred's utility.

 

If you had one of those vote-for-features things, this would literally get all my votes. It's the only feature I would want to add to Alfred (except perhaps undo when deleting stuff in Workflows).

 

I've been mulling over what you said re "think in terms of what to include, not what to exclude", but in some situations, this is simply impossible wrt Alfred's global search, and massively impractical wrt file filters (including 100 folders/filetypes because I can't exclude 1).

 

I'm not sure what you are not buying… You have shown that you can bring back all matching search results (30,000!!!) and subsequently filter. My point is, over time, this would absolutely bloat out mds and Alfred as the sheer amount of memory needed to hold your 30k results, especially with OS X's caching. Imagine a user had half a million matching results, and a slower Mac with a slower drive and less memory.

 

From day one, I have made sure that Alfred is as lean and as unobtrusive to your Mac as possible, which is why I haven't implemented this bulldozer approach.

Link to comment

Thanks for responding.

 

I pulled in so many results because I was interested in determining the performance hit of various kinds of post-search filtering.

 

To be clear, I'm not convinced that excluding directories by checking to see if the filepath of a result starts with the path of the directory would create a great deal of overhead or complexity. And the lack of such a feature does create quite a bit of complexity in certain use cases.

 

That said, I know little about how mds works (and nothing of Alfred's inner workings), and I can imagine situations where that might be a PITA, so I'll take your word for it.

 

I have added a corresponding thread to the feature request forum, if only to see if any other users miss blacklisting as much as I do.

Edited by deanishe
Link to comment
  • 4 weeks later...

If you want to implement this feature on your own, deanishe, then you could just create a workflow that does it. You could just set it up so that you query everything using mdfind filtering for just the names. Then you could setup your own exclusion code.

 

Basically, just use the code that you wrote above as a packaged workflow for a more targeted search.

Link to comment
  • 4 years later...

@Andrew

On 10/30/2013 at 6:32 PM, deanishe said:

Thanks for responding.

 

I pulled in so many results because I was interested in determining the performance hit of various kinds of post-search filtering.

 

To be clear, I'm not convinced that excluding directories by checking to see if the filepath of a result starts with the path of the directory would create a great deal of overhead or complexity. And the lack of such a feature does create quite a bit of complexity in certain use cases.

 

That said, I know little about how mds works (and nothing of Alfred's inner workings), and I can imagine situations where that might be a PITA, so I'll take your word for it.

 

I have added a corresponding thread to the feature request forum, if only to see if any other users miss blacklisting as much as I do.

 

I came here through Google because I have the same issue. Are there any new developments since this thread started?

Edited by nhat
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...