Jump to content

Search results too limited?


Recommended Posts

I decided to make a workflow for one of my most common tasks, searching inside talk files for a keyword. I:

  • selected Templates > Files & Apps > File filter from keyword and open, and then set the name, etc.,
  • dragged a Keynote and a PowerPoint file to the "File types" box,
  • added the two main folders where talks exist in the Search Scope tab, and
  • added "kMDItemTextContent" in the Advanced tab.

It works as expected to find talks with a keyword inside, but it is only showing 2 of the 6 files that

mdfind coenzyme -onlyin ~ | grep \.key$; mdfind coenzyme -onlyin ~ | grep \.pptx$

does.

 

Is my problem what I have set in Default Results? Thanks in advance.

 

Screen%2BShot%2B2015-01-02%2Bat%2B10.53.

Link to comment

I decided to make a workflow for one of my most common tasks, searching inside talk files for a keyword. I:

  • selected Templates > Files & Apps > File filter from keyword and open, and then set the name, etc.,
  • dragged a Keynote and a PowerPoint file to the "File types" box,
  • added the two main folders where talks exist in the Search Scope tab, and
  • added "kMDItemTextContent" in the Advanced tab.

It works as expected to find talks with a keyword inside, but it is only showing 2 of the 6 files that

mdfind coenzyme -onlyin ~ | grep \.key$; mdfind coenzyme -onlyin ~ | grep \.pptx$

does.

 

Is my problem what I have set in Default Results? Thanks in advance.

 

When searching specifically for a file type in Alfred's filter, it will be setting the file content type in the mdfind query (and the scope you have set). The mdfind you are doing searches your entire drive for all file types then grep through for the file types (which may not contain the correct metadata). This will potentially match more...

 

Could you share your file filter workflow so I can take a look. Also, are the files not being found inside your search scope, if so, can you do an mdls on one of those files to check the kMDItemContentType.

 

Cheers,

Andrew

Link to comment

Thanks super for helping! For my mdfind, I chose "-onlyin ~", so it's not searching the entire drive, just my home folder.

 

It's not finding any of the Keynote files. When I dropped a Keynote presentation on the FileTypes window in the workflow, it identified it as com.apple.iwork.keynote.key, but the mdls shows a Keynote files as kMDItemContentType = "com.apple.iwork.keynote.sffkey". Not sure if that has anything to do with this.

 

Screenshots from the file filter workflow:

 

Q2OVmX2.png

 

iMDFQff.png

 

81LM2ac.png

 

Results from mdls on a file not found:

$ mdls CoQ10.key
kMDItemAlternateNames          = (
    "2012 CoQ10.key"
)
kMDItemAuthors                 = (
    ""
)
kMDItemComment                 = ""
kMDItemContentCreationDate     = 2012-11-24 19:44:03 +0000
kMDItemContentModificationDate = 2012-12-06 13:39:47 +0000
kMDItemContentType             = "com.apple.iwork.keynote.sffkey"
kMDItemContentTypeTree         = (
    "com.apple.iwork.keynote.sffkey",
    "public.zip-archive",
    "com.pkware.zip-archive",
    "public.data",
    "public.item",
    "public.archive",
    "public.presentation",
    "public.composite-content",
    "public.content"
)
kMDItemDateAdded               = 2013-10-28 03:48:39 +0000
kMDItemDisplayName             = "2012 CoQ10"
kMDItemFSContentChangeDate     = 2012-12-06 13:39:47 +0000
kMDItemFSCreationDate          = 2012-11-24 19:44:03 +0000
kMDItemFSCreatorCode           = ""
kMDItemFSFinderFlags           = 16
kMDItemFSHasCustomIcon         = (null)
kMDItemFSInvisible             = 0
kMDItemFSIsExtensionHidden     = 1
kMDItemFSIsStationery          = (null)
kMDItemFSLabel                 = 0
kMDItemFSName                  = "2012 CoQ10.key"
kMDItemFSNodeCount             = (null)
kMDItemFSOwnerGroupID          = 20
kMDItemFSOwnerUserID           = 501
kMDItemFSSize                  = 32139118
kMDItemFSTypeCode              = ""
kMDItemKind                    = "Keynote Presentation"
kMDItemLastUsedDate            = 2014-12-30 17:12:49 +0000
kMDItemLogicalSize             = 32139118
kMDItemPhysicalSize            = 32141312
kMDItemTitle                   = ""
kMDItemUseCount                = 4
kMDItemUsedDates               = (
    "2014-12-30 06:00:00 +0000"
)
~$ 

Link to comment

That did it! Many thanks. Guess Apple changed the MIME type at some point. What didn't change was the file extension. It would be *wonderful* if I could specify the file extension (similar to the "grep \.key$" in my mdfind) in workflow searches, as they would survive such back end modifications :)

Link to comment

That did it! Many thanks. Guess Apple changed the MIME type at some point. What didn't change was the file extension. It would be *wonderful* if I could specify the file extension (similar to the "grep \.key$" in my mdfind) in workflow searches, as they would survive such back end modifications :)

 

This is tricky as it would become extremely inefficient with large result sets. Alfred is very fast for file results as he creates and dispatches carefully crafted queries to the metadata server instead of requesting all results then subsequently filtering.

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