Norris Posted May 17, 2014 Share Posted May 17, 2014 I'm loving alfred since the beta releases. And since that time one thing has been bugging me - alfred search results. I'll give you an example: When I type "open changelog.txt" I get all sorts of results, however all I wanted was to view a changelog.txt file that I've created. I'm a web developer, so I use tools of others (node_modules) and others also have their changelog.txt or changelog.md, etc. files - as a result I'm left at the mercy of the "smart filter" that alfred has, which is proving not to be as smart sometimes. So with 'open changelog' I get a list of all sorts of stuff: /some_game/libs/changelog.txt /sites/other-domain.com/tool2/changelog.txt /sites/other-domain.com/tool1/changelog.txt /sites/mysite.dev/changelog.txt /sites/my-other-site.dev/tool1/changelog.txt I've narrowed the example down to 5 results. Spotlight says I have around 130 "changelog.txt" files currently on my system. Often enough I don't even see the file I'm looking for in results 1-9 ( for cmd+number access ). This is extremely problematic to me. And it's not only changelog files. It's the 'wp-content' or 'themes' directory for wordpress ( I have 19 of them right now ), and so on So - the suggestion: Introduce a filter for alfred search results.I don't care what the interface looks like, I could easily use 'open changelog --path mysite.dev'or 'find mysite.dev then changelog.txt' or 'find themes in mysite.dev' or even 'mysite dev changelog'All I know that there must be a way to filter down the search results. Currently it only works for the filename, but the problem is that my filenames repeat themselves quite a bit. Alfred does a really good job of finding my files, I see a bunch of changelogs already when I type "open cha". If I was able to do "open cha -filter mysite" alfred would be the ultimate productivity tool for me as I'd be able to access the files I need in seconds. Link to comment Share on other sites More sharing options...
Tyler Eich Posted May 17, 2014 Share Posted May 17, 2014 The following suggestions require a Powerpack license You may be interested in one of two workflows by deanishe: Subdirectory Search Fuzzy Folders (deprecated Subdirectory Search) Or you could create a custom file filter that only searches the 'mysite.dev' folder you mentioned. With this method, you'd have to add a filter for each folder where you wanted to isolate search. Link to comment Share on other sites More sharing options...
Norris Posted May 17, 2014 Author Share Posted May 17, 2014 (edited) Thanks Tyler,While I appreciate Fuzzy Folders, I think it's only halfway there. In order to open changelog.txt from mysite.dev right now I have to: 1. Install Fuzzy Folders2. Setup msite.dev to be a fuzzy folder 3. Set a keyword for my fuzzy folder 4. Now type "myfuzzysite changelog" 5. Find the changelog file out of the 9 results that I see thereNext time I have to add another folder, I will occupy another "keyword" and will have to repeat steps 2-5. And right now I have to repeat steps 2-5 for the 10 folders I already have. It's a workaround. Not a solution.This is how a solution looks like: "changelog mysite somelib" I understand that might bring up some fuzzy issues, so adding a new keyword would work too:"lookfor changelog mysite somelib" Where alfred would use "lookfor" as a keyword ( configurable, I'd replace the default ' or f with that ) to trigger fuzzy path filter. Note that I'm not suggesting a Fuzzy Path Search, where Alfred would have to constantly keep track of all file paths on the system. That would probably be terrible for performance. I'm suggesting that already found results ( find changelog ) could be further filtered by path ( find changelog filter:mysite ). Edited May 17, 2014 by Norris Link to comment Share on other sites More sharing options...
jdfwarrior Posted May 18, 2014 Share Posted May 18, 2014 Thanks Tyler, While I appreciate Fuzzy Folders, I think it's only halfway there. In order to open changelog.txt from mysite.dev right now I have to: 1. Install Fuzzy Folders 2. Setup msite.dev to be a fuzzy folder 3. Set a keyword for my fuzzy folder 4. Now type "myfuzzysite changelog" 5. Find the changelog file out of the 9 results that I see there Next time I have to add another folder, I will occupy another "keyword" and will have to repeat steps 2-5. And right now I have to repeat steps 2-5 for the 10 folders I already have. It's a workaround. Not a solution. This is how a solution looks like: "changelog mysite somelib" I understand that might bring up some fuzzy issues, so adding a new keyword would work too: "lookfor changelog mysite somelib" Where alfred would use "lookfor" as a keyword ( configurable, I'd replace the default ' or f with that ) to trigger fuzzy path filter. Note that I'm not suggesting a Fuzzy Path Search, where Alfred would have to constantly keep track of all file paths on the system. That would probably be terrible for performance. I'm suggesting that already found results ( find changelog ) could be further filtered by path ( find changelog filter:mysite ). This is kind of a tough problem because you want it to show changelogs, but not all changelogs, you want it from a certain folder, but not all of them that could be in that folder. It's a very specific search. I dont know if you would be up for this or not but. if you're running Mavericks, tags might be a good way to solve this. You could apply a tag to the root level of the project and then have a changelog tag for the ones that you wanted to be able to find (if there were multiple). Then, you could use Alfred's tags keyword to search for the items that met all the tags specified. So, for instance, if you had a project called "my cool new project", and you had a changelog inside of there, you could add a 'mycoolproject' tag and a 'changelog' tag to that file and then pop up Alfred and search: "tags mycoolproject changelog" and that would show JUST that file. Obviously, as mentioned this requires you using tags but.. right now I think the only other thing that would get you really close is a custom workflow (maybe similar to some of the ones tyler mentioned, I don't know, I haven't tried those). I dont know if you use Hazel or not but Hazel would be an easy way to auto assign tags and such to files. I believe that there are also several workflows for assigning tags to files. That may speed things up a bit too when it comes to setting things up. Link to comment Share on other sites More sharing options...
Norris Posted May 18, 2014 Author Share Posted May 18, 2014 David, just as Tyler - you're imagining it as a "new kind of a search" that is very complicated and very specific. It's not.When I type "open changelog" right now I see: changelog.txt /some/weird/path/to/some/place/changelog.txt changelog.md /some/other/path/to/changelog.md changelog.txt /User/N/Sites/mysite.dev/wp-content/themes/mytheme/changelog.txt changelog.md /User/N/Sites/mysite.dev/wp-content/themes/mytheme/assets/some_library_i_use/changelog.md See? The Paths are already there! All the necessary info for the filter is already there! All I want is a way to filter by the paths already available to me. That's why I wrote it in the feature suggestions. All the other ways are "workarounds" that require me to tag, categorize, etc. before I can act, but a filter like this would be very easy to add on and make a huge difference. Link to comment Share on other sites More sharing options...
ctwise Posted May 19, 2014 Share Posted May 19, 2014 David, just as Tyler - you're imagining it as a "new kind of a search" that is very complicated and very specific. It's not. When I type "open changelog" right now I see: See? The Paths are already there! All the necessary info for the filter is already there! All I want is a way to filter by the paths already available to me. That's why I wrote it in the feature suggestions. All the other ways are "workarounds" that require me to tag, categorize, etc. before I can act, but a filter like this would be very easy to add on and make a huge difference. I don't think you're going to get this. It would mean changing "modes" into one that filters the results list by whatever you start typing. For example, you have your list of files, you change into filter "mode" and type text that's in the path of the entry you want, reducing the list down to that file. The approach that's much more "Alfred" is to change the query. Unfortunately, as you've already discovered, the query is literal when it should allow globbing. Following your example, if I type 'open changelog' and get a loooong list of files, I want to narrow it down to one that's below the 'sails' directory, so I _want_ to be able to type something like this 'open **/sails/**/changelog.md' but the best I can get is 'open changelog.md' and then paging through _lots_ of results. So, the feature _I_ would like, is that Alfred searches by the full path unless it contains globbing characters. If it does, search by the file name and filter by the globbing pattern. From the user's perspective it would look like Alfred was searching by a globbing pattern but it would be much more efficient and performant for Alfred. Link to comment Share on other sites More sharing options...
Norris Posted May 23, 2014 Author Share Posted May 23, 2014 (edited) I actually wouldn't mind a fully blown path search at all! That would be an awesome feature to have. 90% of the time when I open files, I know exactly which file I want to open and where it is. For example I want "/Users/N/Pictures/Vacations/Paris/sitting in a cafe.jpg" and not the picture where I'm sitting in a cafe in Rome or Madrid. So typing "open pic par cafe" would be really badass!However, about a year ago I already came up with the suggestion and from what I understood at the time was that it Alfred doesn't keep track of the paths out of the box ( it just pulls them up as needed ), and keeping an index of everything that way would slow everything down. I might be mistaken, I don't know this for sure, but that's how I remember it. And that made me think of this alternative way on how do to it - it's basically the same thing, but in a reverse order ( you get to filter paths when you've pulled them up )Of course some core functionality modification is needed ( like possible responding to keywords after the first words or such ), which is why I posted this in the features suggestion Edited May 23, 2014 by Norris Link to comment Share on other sites More sharing options...
Andrew Posted May 23, 2014 Share Posted May 23, 2014 The fundamental reason Alfred doesn't provide this kind of search by default is that the OS X metadata server doesn't have context of the path as part of the search parameters, he only knows the path as part of the results returned to him. For performance (including memory) reasons, Alfred asks OS X for the most likely matches for a file given a set of constrains and knowledge, which is a subset of all matches (which could be thousands). As such, he can't subsequently filter through the paths and return the items you want as this would inevitably be missing some which didn't make the initial cut of results. i.e. you may have 1000 files named 'cafe', but Alfred is only getting the first 50 most likely matches from OS X and could only then filter through the paths for that. This would lead to confusing behaviour as the file you are looking for falls in the 950 which didn't match most likely and therefore you get no results. One fix could be that Alfred does his own indexing, but this would turn Alfred into a big fat bloaty beast... something I'm not willing to allow when using OS X's very mature indexing engine provides perfect file searching for 99.9% of users. Have you tried filtering and navigating through Alfred's file system navigation? If you know the exact location you want, you can actually get to that file extremely quickly, especially if you start with a file filter for folders (one of the built in workflow examples). In your [Norris] case, you would use the file filter to search for e.g. Vacations, then use cmd+down to enter file system navigation, start typing "Paris", press enter to select the folder when you see it, then start typing 'sitting'. The file system navigation works like bash, so you can even use wildcards like *in*cafe. Cheers, Andrew Link to comment Share on other sites More sharing options...
ctwise Posted May 23, 2014 Share Posted May 23, 2014 The fundamental reason Alfred doesn't provide this kind of search by default is that the OS X metadata server doesn't have context of the path as part of the search parameters, he only knows the path as part of the results returned to him. For performance (including memory) reasons, Alfred asks OS X for the most likely matches for a file given a set of constrains and knowledge, which is a subset of all matches (which could be thousands). As such, he can't subsequently filter through the paths and return the items you want as this would inevitably be missing some which didn't make the initial cut of results. i.e. you may have 1000 files named 'cafe', but Alfred is only getting the first 50 most likely matches from OS X and could only then filter through the paths for that. This would lead to confusing behaviour as the file you are looking for falls in the 950 which didn't match most likely and therefore you get no results. One fix could be that Alfred does his own indexing, but this would turn Alfred into a big fat bloaty beast... something I'm not willing to allow when using OS X's very mature indexing engine provides perfect file searching for 99.9% of users. Have you tried filtering and navigating through Alfred's file system navigation? If you know the exact location you want, you can actually get to that file extremely quickly, especially if you start with a file filter for folders (one of the built in workflow examples). In your [Norris] case, you would use the file filter to search for e.g. Vacations, then use cmd+down to enter file system navigation, start typing "Paris", press enter to select the folder when you see it, then start typing 'sitting'. The file system navigation works like bash, so you can even use wildcards like *in*cafe. Cheers, Andrew Right, and filtering the results doesn't increase the number of results being returned, it changes which ones are being displayed. So, entering: open python.framework/examples/pyobjc/guitests/readme.txt would be the functional equivalent of this: mdfind name:readme.txt | grep -i python.framework/examples/pyobjc/guitests and far, far more useful then this: open readme.txt In general, where Spotlight is being used as a search source, it would be extremely useful to be able to control that searching more directly using Spotlight syntax, e.g., 'tag:x', 'name:x', etc. in addition to adding filtering. Link to comment Share on other sites More sharing options...
deanishe Posted May 24, 2014 Share Posted May 24, 2014 Thanks Tyler, While I appreciate Fuzzy Folders, I think it's only halfway there. In order to open changelog.txt from mysite.dev right now I have to: 1. Install Fuzzy Folders 2. Setup msite.dev to be a fuzzy folder 3. Set a keyword for my fuzzy folder 4. Now type "myfuzzysite changelog" 5. Find the changelog file out of the 9 results that I see there Next time I have to add another folder, I will occupy another "keyword" and will have to repeat steps 2-5. And right now I have to repeat steps 2-5 for the 10 folders I already have. It's a workaround. Not a solution. This is how a solution looks like: "changelog mysite somelib" I understand that might bring up some fuzzy issues, so adding a new keyword would work too: "lookfor changelog mysite somelib" Where alfred would use "lookfor" as a keyword ( configurable, I'd replace the default ' or f with that ) to trigger fuzzy path filter. Note that I'm not suggesting a Fuzzy Path Search, where Alfred would have to constantly keep track of all file paths on the system. That would probably be terrible for performance. I'm suggesting that already found results ( find changelog ) could be further filtered by path ( find changelog filter:mysite ). With Fuzzy Folders, I set a single, very short keyword (e.g. ".p") for my projects directory, then use, e.g. ".p mysite somelib changelog". There is also the ability to set glob-style exclude patterns (though you have to do this manually in the settings file). I've asked Andrew about this kind of thing previously, and it just doesn't fit with the way Alfred works. This is the reason I wrote Fuzzy Folders. Link to comment Share on other sites More sharing options...
Norris Posted May 24, 2014 Author Share Posted May 24, 2014 (edited) In your [Norris] case, you would use the file filter to search for e.g. Vacations, then use cmd+down to enter file system navigation, start typing "Paris", press enter to select the folder when you see it, then start typing 'sitting'. The file system navigation works like bash, so you can even use wildcards like *in*cafe. Thanks for the elaborate reply Andrew! The problem in my case is that I have multiple "Vacations" folders and it's not so easy to target them.The vacations was a really simplified version of what's actually going on. What I have is more like this: /Users/N/Sites/project1/wp-content/themes/project1-theme/project1.sublime-workspace /Users/N/Sites/project2/wp-content/themes/project2-theme/project2.sublime-workspace /Users/N/Sites/project3/wp-content/themes/project3-theme/project3.sublime-workspace On top of that, I have: /Users/N/Dropbox/Projects/Publishing/project1/project1.zip /Users/N/Dropbox/Projects/Publishing/project1/project1_sources/ /Users/N/Dropbox/Projects/Publishing/project2/project2.zip /Users/N/Dropbox/Projects/Publishing/project2/project2_sources/ /Users/N/Dropbox/Projects/Publishing/project3/project3.zip /Users/N/Dropbox/Projects/Publishing/project3/project3_sources/ My projects are automatically zipped & copied to my Dropbox folder in Publishing when I publish something, and I like to keep them there for duplication. I could exclude those folders, but I would have to do that for each project, targeting specific folders, because I also have /Users/N/Dropbox/Projects/Publishing/project3/project3_stuff_that_I_dont_have_anywhere_else/ Path filtering would solve all my troubles, even if it were to work only on the first 50 results. The initial alfreds search query is almost always "close enough" for me. - Adding filters would let me access the correct file quicker, instead of "open project3 ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ⏎" I don't want Alfred to replace spotlight or to be a "full search engine", I just want to get to the files that I need a bit quicker... Edited May 24, 2014 by Norris Link to comment Share on other sites More sharing options...
deanishe Posted May 24, 2014 Share Posted May 24, 2014 If it's the sublime-workspace files you're interested in, create a File Filter than only shows that kind of file (possibly restricting the search scope, as well, if necessary). I do this with sublime-project files. If you want to search specific subfolders only, use the above-mentioned Fuzzy Folders workflow. Set ~/Dropbox/Projects/Publishing as a Fuzzy Folder (with, say, .p as the keyword), and add *.zip to the excludes list. Using your fake examples, .p 3 <query> would only show matches within project3. If you provided more realistic data and were more specific in exactly what you're trying to find, I might be able to provide more useful advice. Link to comment Share on other sites More sharing options...
ctwise Posted May 25, 2014 Share Posted May 25, 2014 If it's the sublime-workspace files you're interested in, create a File Filter than only shows that kind of file (possibly restricting the search scope, as well, if necessary). I do this with sublime-project files. If you want to search specific subfolders only, use the above-mentioned Fuzzy Folders workflow. Set ~/Dropbox/Projects/Publishing as a Fuzzy Folder (with, say, .p as the keyword), and add *.zip to the excludes list. Using your fake examples, .p 3 <query> would only show matches within project3. If you provided more realistic data and were more specific in exactly what you're trying to find, I might be able to provide more useful advice. Don't get me wrong, if what we're discussing never gets implemented, I'm fine with that, slightly less happy then if it _does_ get implemented, but still fine. However, it would be awesome if filtering worked _everywhere_ a filename is accepted. Like I said before, if you could provide a globbing pattern, then the base filename could be sent through spotlight and then Alfred itself could filter down the results using the path globbing pattern. So entering 'myproj/**/readme.txt' would send 'readme.txt' through spotlight and then the results would be filtered _by Alfred_ using the 'myproj/**' globbing pattern. You go from hundreds of results to just a handful and it requires very little additional work. Link to comment Share on other sites More sharing options...
deanishe Posted May 25, 2014 Share Posted May 25, 2014 That's pretty much exactly how Fuzzy Folders works, but with a less complicated query format than globbing patterns. It should be fairly straightforward to create a fork that uses globbing. Might be a useful stop-gap. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now