Jump to content
Jasondm007

Removing keywords in fallback searches?

Recommended Posts

Is it possible to remove a keyword that winds up being used in a fallback search?

 

Since I’m probably not asking this question in the appropriate Alfred lingo, let me provide an example.

  1. Let’s say you have a file filter that uses the keyword “oo” when searching for OmniOutliner files.
  2. After searching for “oo searchterm in Alfred, it doesn’t find anything relevant, and so you decide to use one of your fallback searches. 
  3. For simplicity, let’s say you select the default Google search fallback. 
  4. When run, Google searches for the following: “oo searchterm”. My question is whether it could be run without the “oo “ (i.e., without the keyword and space). In other words, could Alfred snip out everything before the first blank space in the search (and preferably the first blank space, too)?

 

To be clear, my question is not specific to Alfred’s default Google search fallback. I have other fallbacks that use Finder, Spotlight, etc that I’d like to solve the problem with. 

 

I just find it annoying to always have to go back and clip off that first bit, especially when the searches all follow the same pattern (unnecessarykeyword+blankspace).

 

Thanks for your help!

Share this post


Link to post

Since a fallback search can't determine what you have in mind when you give it a string to process, there's no way it could intelligently remove the first word of a string (well, from my understanding). Therefore, I think you best bet would be to redefine the fallback searches that you wish them to process how you define it.

 

I did a workflow as an example to show you as a way to make a more "intelligent" fallback search based on your criteria. I did two version, but I think the first one would be the best one to use as a replacement to the default fallback search, but need a little more work from your side. In short, you make a list of keywords separated by semicolon and if you send a string to this fallback search and the workflow find that the first word is into this keywords list, then it will remove it or if not found it would keep the string as is. The second example always remove the first word, so maybe best to use next to the default fallback search.

 

To change the keywords list or add to it for the first method, just look into the environment variable in the Workflow preferences. I put ";" as the delimiter, but let you change it if you prefer another one

 

Link: https://nofile.io/f/RX05s5Z9c8o/Fallback+Search+-+Removed+Keyword.alfredworkflow

 

Best

Edited by GuiB

Share this post


Link to post

@Jasondm007, sorry, I don't know what happened, but here is another try at uploading:

 

https://nofile.io/f/RX05s5Z9c8o/Fallback+Search+-+Removed+Keyword.alfredworkflow

 

--------

Edit:

Make sure to add the Fallback Search to you Default Results Fallback Searches at :

Alfred Preferences -> Default Results -> Setup fallback results -> + -> Workflow trigger -> Search Google for '{query}' (Removing keyword)   or   Search Google for '{query}' (Removing first word)

Edited by GuiB

Share this post


Link to post

Hello,

my very first post here.

id like to know how to achieve this, but the example link has broken. Can anyone help to elaborate or upload again? 

 

Thanks.

 

 

 

Share this post


Link to post
19 hours ago, GuiB said:

@.ed , I have updated the link in my post above. Just try again and it should work now

Thank you so much! It works great!   :)

Share this post


Link to post

@GuiB I'm not sure how I missed your response above (perhaps, the holiday fog?), but I recently stumbled on this thread when looking for a fix to the same problem.

 

In any event, I just wanted to apologize for the slow response and thank you for posting your workflow. It's brilliant, and works like a charm!

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...