Jump to content

Is there a way to filter "find" and "open" results


Recommended Posts

@ihodes Welcome to the forum! It depends how Things.app classifies its files as to whether they'll be easy to exclude.

 

Try the following: Locate a Things.app file in "find", press the right arrow and choose "Copy path to clipboard". You can then pop Alfred back up and type ">mdls" and paste in the path you just copied. This will result in Terminal launching and outputting the metadata for the file. 

 

Copy the results of the Terminal output here and we'll take a look at what content types are used.

 

As you're a Powerpack user, don't forget that you have access to the power of file filters, which are often a better way to search than using the "find" and "open" keywords as they're completely customisable filters. You can create them to search in specific scopes (e.g. only Work related folders) or for specific file types (e.g. only PDFs or images).

 

You can find out more about file filters here:

https://www.alfredapp.com/help/workflows/inputs/file-filter/

 

Let me know how you get on and I'll be happy to help you further :)

 

Cheers,
Vero

Link to comment

Hi Vero—thanks for the welcome & the reply! 

 

The results are below:

_kMDItemOwnerUserID            = 502
kMDItemContentCreationDate     = 2017-04-03 04:00:29 +0000
kMDItemContentModificationDate = 2017-04-03 04:00:29 +0000
kMDItemContentType             = "com.culturedcode.thingsitem"
kMDItemContentTypeTree         = (
    "com.culturedcode.thingsitem",
    "public.xml",
    "public.text",
    "com.culturedcode.thingsitem",
    "public.data",
    "public.item",
    "public.content"
)
kMDItemDateAdded               = 2017-04-03 04:00:29 +0000
kMDItemDisplayName             = "Work out"
kMDItemFSContentChangeDate     = 2017-04-03 04:00:29 +0000
kMDItemFSCreationDate          = 2017-04-03 04:00:29 +0000
kMDItemFSCreatorCode           = ""
kMDItemFSFinderFlags           = 0
kMDItemFSHasCustomIcon         = (null)
kMDItemFSInvisible             = 0
kMDItemFSIsExtensionHidden     = 0
kMDItemFSIsStationery          = (null)
kMDItemFSLabel                 = 0
kMDItemFSName                  = "6193AA1F-9C18-4DA4-81CA-2FD3B6200B2A-20170403.thingsitem"
kMDItemFSNodeCount             = (null)
kMDItemFSOwnerGroupID          = 20
kMDItemFSOwnerUserID           = 502
kMDItemFSSize                  = 188
kMDItemFSTypeCode              = ""
kMDItemKind                    = "Things item"
kMDItemLogicalSize             = 188
kMDItemPhysicalSize            = 4096
kMDItemTitle                   = "Work out"

 

Edited by ihodes
Link to comment
  • 2 weeks later...

I'm not sure it's reasonable to ask a developer to completely rework how they store their data (especially when storing items as files is not an unreasonable design choice). 

 

I'd think it within the realm of reason that Alfred's search could be filtered (using regex, for example). 

Link to comment
10 minutes ago, ihodes said:

I'm not sure it's reasonable to ask a developer to completely rework how they store their data (especially when storing items as files is not an unreasonable design choice). 

 

That isn't what's happening. Alfred isn't finding Things' actual datastore, it's finding the data Things explicitly exports so Spotlight and other apps can find them.

 

I've just re-installed Things, and you need to open its preferences and in the General tab uncheck the option "Include Things items in Spotlight search results". That will remove the exported data that Alfred is finding (they're in ~/Library/Caches/Metadata/com.culturedcode.things/Things).

 

10 minutes ago, ihodes said:

I'd think it within the realm of reason that Alfred's search could be filtered (using regex, for example). 

 

It isn't. Alfred uses the system metadata index (i.e. the Spotlight database). And it does not allow exclusions other than adding folders to Spotlight's Privacy pane or adding alfred:ignore to each item's Spotlight comments.

 

It's a bummer, but that's down to Apple.

 

It Alfred were to load and filter all the results provided by the API in order to perform additional filtering, the performance hit would be enormous.

Edited by deanishe
Link to comment
6 minutes ago, deanishe said:

I've just re-installed Things, and you need to open its preferences and in the General tab uncheck the option "Include Things items in Spotlight search results". That will remove the exported data that Alfred is finding (they're in ~/Library/Caches/Metadata/com.culturedcode.things/Things).

 

 

This is super helpful, thank you!

 

6 minutes ago, deanishe said:

It isn't. Alfred uses the system metadata index (i.e. the Spotlight database). And it does not allow exclusions other than adding folders to Spotlight's Privacy pane or adding alfred:ignore to each item's Spotlight comments.

 

 

I'd think the filenames could still be filtered at display-time by regex, lazily, without a real performance hit. You'd just be filtering the first N results needed to get 10/the displayed number of results.  

Link to comment
Just now, ihodes said:

I'd think the filenames could still be filtered at display-time by regex, lazily, without a real performance hit. You'd just be filtering the first N results needed to get 10/the displayed number of results.  

 

It's impossible to avoid the performance hit. Some searches might be almost as fast as without additional, Alfred-side filtering, but many won't.

 

Consider a nodejs-based project: you likely have many thousands of files in the node_modules subdirectory. To only search the files belonging to your actual project, Alfred would have to load all the results and then throw 99%+ of them away (the ones in node_modules).

 

To be perfectly clear, I've argued for blacklisting many times myself (the way Alfred currently works makes it entirely unsuitable for the above nodejs example), but you are going to take a huge performance hit for that. No avoiding it. That's just how the API works.

 

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...