Jump to content

Index kMDItemAlternateNames attribute


tmonney
 Share

Recommended Posts

Hi,

 

First of all, thanks for this great tool!

 

I noticed that Alfred does not take the kMDItemAlternateNames attribute into account when indexing/searching.

 

The basic use case is described at https://github.com/phinze/homebrew-cask/issues/2847. Basically, homebrew-cask now allows to change the target symlink it creates in ~/Applications. This is useful when several applications have the same final name (for example, multiple Eclipse IDE variations end up in ~/Applications/Eclipse.app. Using target renaming, one can have ~/Applications/Eclipse.app and ~/Applications/Scala IDE.app, pointing to /opt/homebrew-cask/Caskroom/eclipse-ide/4.3.1/eclipse/Eclipse.app, resp. /opt/homebrew-cask/Caskroom/scala-ide/3.0.2/eclipse/Eclipse.app.

 

The problem now is that one cannot search 'Scala IDE', since neither Alfred nor Spotlight index symlinks. A solution is to add extended attributes to the application bundle. Concretely, running the following:

 

$ xattr -w com.apple.metadata:kMDItemAlternateNames '("Scala IDE")' /opt/homebrew-cask/Caskroom/scala-ide/3.0.2/eclipse/Eclipse.app

 

allows Spotlight to find the application with the 'Scala IDE' query. Alfred does not index it though. It would be nice to

  1. index the kMDItemAlternateNames attribute
  2. use it as the displayed label in the Alfred search box when a match is found on this attribute

Thoughts?

 

Link to comment
Share on other sites

Hi,

 

First of all, thanks for this great tool!

 

I noticed that Alfred does not take the kMDItemAlternateNames attribute into account when indexing/searching.

 

The basic use case is described at https://github.com/phinze/homebrew-cask/issues/2847. Basically, homebrew-cask now allows to change the target symlink it creates in ~/Applications. This is useful when several applications have the same final name (for example, multiple Eclipse IDE variations end up in ~/Applications/Eclipse.app. Using target renaming, one can have ~/Applications/Eclipse.app and ~/Applications/Scala IDE.app, pointing to /opt/homebrew-cask/Caskroom/eclipse-ide/4.3.1/eclipse/Eclipse.app, resp. /opt/homebrew-cask/Caskroom/scala-ide/3.0.2/eclipse/Eclipse.app.

 

The problem now is that one cannot search 'Scala IDE', since neither Alfred nor Spotlight index symlinks. A solution is to add extended attributes to the application bundle. Concretely, running the following:

 

$ xattr -w com.apple.metadata:kMDItemAlternateNames '("Scala IDE")' /opt/homebrew-cask/Caskroom/scala-ide/3.0.2/eclipse/Eclipse.app

 

allows Spotlight to find the application with the 'Scala IDE' query. Alfred does not index it though. It would be nice to

  1. index the kMDItemAlternateNames attribute
  2. use it as the displayed label in the Alfred search box when a match is found on this attribute

Thoughts?

 

Alfred does take into account alternative names, but not in his app cache. I've actually fixed this already for the upcoming Alfred 2.2 release though, as it also addresses a localisation issue.

 

If you prefix a search with [spacebar], it bypasses the app cache, so you'll likely see eclipse when typing:

 

[spacebar]scala

 

Cheers,

Andrew

Link to comment
Share on other sites

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
 Share

×
×
  • Create New...