Jump to content

Searchio! Auto-suggestion from search engines in different languages


Recommended Posts

Searchio! workflow for Alfred

Auto-suggest search results from multiple search engines and languages.

 

There are a few existing workflows that provide auto-suggest results from one or the other search engine, but this includes not only multiple search engines, but also allows you to specify multiple languages/regions for your results.

demo.gif

Supports the following search engines/websites:

  • Google
  • Google Images
  • Google Maps
  • YouTube
  • Wikipedia
  • Wiktionary
  • Amazon
  • eBay
  • DuckDuckGo
  • Bing
  • Yahoo!
  • Ask.com
  • Yandex.ru
  • Naver.com
  • Wikia.com

 

Download and installation

Download the latest version from the GitHub releases page or Packal.

Usage

There are several searches pre-configured. Only some have keywords (i.e. can be used as-is):

  • g — Search Google in system (i.e. default) language
  • m — Search Google Maps in system (i.e. default) language
  • gi — Search Google Images in system (i.e. default) language
  • w — Search Wikipedia in system (i.e. default) language
  • wn — Search Wiktionary in system (i.e. default) language
  • a — Search Amazon in system (i.e. default) language. If your system language is English, this will search Amazon.com. Use -l uk in the Script Filter to search Amazon.co.uk or -l ca to search Amazon.ca.
  • yt — Search YouTube in system (i.e. default) language
  • searchio [<query>] — Show settings and list of supported search engines. Currently, the only setting is a toggle to also show the <query> in the results list (default: No).
  • searchiohelp — Open help file in your browser

You can add a keyword to (and edit) one of the existing examples or add your own searches. For details on how to do that, see the GitHub page.

 

Licensing, thanks

The code in this workflow is released under the MIT Licence.

The icons belong to the respective search engines.

This workflow uses the Alfred-Workflow library and docopt (both MIT-licensed).

Edited by deanishe
Update list of supported search engines
Link to comment

Awesome workflow. I like the versatility! This is truly amazing. I can see the potential for this workflow to evolve and include other searches such as IMDb and the like, so we don't need separate workflows for the same tasks. Cyber-highfive!

 

One thing that'd be a nice addition would be the option to hold a modifier key to do a regular search without the suggesting feature.

 

Edit: When using the google part of your workflow it's taking me to the actual search field and i need to hit the enter key in order to do the actual search. Is this intended? 

Edited by Arthur
Link to comment

Hmm. No, it shouldn't be doing that with Google.
 
I did try with including the search query as-is as the top result, but ultimately decided against it. If that's what folks want, I'll put it back in.
 
If you don't mind hacking the source a wee bit, if you comment out line 112 in search.py and uncomment lines 114 and 115, that will make the entered query the first result. 

Using a modifier to turn off suggestions won't work, as that isn't how Alfred uses modifiers. In that case, I'd suggest assigning, for example, the keyword s to a standard Alfred Web Search and si to a Searchio! auto-suggestion search.
 
It should be easy enough to add other search engines, depending on their suggestions API.

Link to comment

Can i do something to help to figure out why it's taking me to the actual search field of google?

 

I'm not savvy enough to edit that kinda stuff mate. I hope other people would want the behavior i do since then there's no need for no custom google search. I love All-in-Ones  :)

Link to comment

I've uploaded a new version with a different URL for Google and an optional setting to toggle showing the query in the search results (use searchio to view the setting and action the "Show query in results" item to toggle the setting).

 

Could you give that one a try and see if Google now works properly for you?

Link to comment

Hi deanishe, is this compatible with Snow Leopard?

 

Not sure, to be honest (I don't have SL to test it on). It should be, however. I don't believe it uses any Python features that weren't around in 2.6.

 

Give it a try, and if there are any errors, we might be able to fix them.

Link to comment
  • 3 weeks later...

I tried that. It doesn't work.

 

The first problem is that you don't get any results till all the web queries finish, so the speed of the workflow is restricted to that of your slowest search engine, and some are a lot faster than others.

 

Secondly, you end up with lots of duplicate results. Either you strip out the duplicates, so you only have results from one search engine, which largely defeats the purpose of combining multiple search engines' results, or you have 10 results that are all the same, just from different places, which isn't very helpful.

 

Thirdly, one of my main motivations was to enable users to search in different languages easily. And by that I mean multiple languages per user. As some search engines are set up by region and others by language, it's not really feasible to combine the results in a meaningful way (pass "uk" to Google or Wikipedia and you get Ukrainian results, pass "uk" to Amazon or Yahoo! and you get results from their British sites).

Link to comment

Yeah. When I started the workflow, that was basically the objective. I wanted to create a super-cool search-all-the-engines! auto-suggest workflow, but it quickly became apparent that it wasn't a particularly viable idea :(

 

Still, I think it's turned out okay. The next step is, hopefully, to make it configurable without having to mess around with the workflow itself, much like Fuzzy Folders works.

 

It annoys the hell out of me having to reconfigure the bleeder to my own purposes after every new release :(

 

The major hurdle is being able to figure out exactly what languages/regions are available for each search engine.

 

I suppose I could add what I'm aware of by default but still allow users to specify different languages/regions.

Edited by deanishe
Link to comment
  • 4 months later...

I get the following error when trying to do a Wikipedia search.  Any ideas?

 

[ERROR: alfred.workflow.input.scriptfilter] Code 1: 10:14:06 search.py:438 DEBUG    subclass : Google

10:14:06 search.py:438 DEBUG    subclass : Google Images
10:14:06 search.py:438 DEBUG    subclass : Google Maps
10:14:06 search.py:438 DEBUG    subclass : YouTube
10:14:06 search.py:438 DEBUG    subclass : Amazon
10:14:06 search.py:438 DEBUG    subclass : eBay
10:14:06 search.py:438 DEBUG    subclass : Bing
10:14:06 search.py:438 DEBUG    subclass : Yahoo!
10:14:06 search.py:438 DEBUG    subclass : DuckDuckGo
10:14:06 search.py:438 DEBUG    subclass : Wiktionary
10:14:06 search.py:438 DEBUG    subclass : Wikipedia
10:14:06 search.py:438 DEBUG    subclass : Ask
10:14:06 search.py:111 DEBUG    key components : [u'Wikipedia', u'lang', u'en', u'query', u'b', u'engine', u'wikipedia']
10:14:06 workflow.py:1210 ERROR    too many values to unpack
Traceback (most recent call last):
  File "/Users/kevinjarnot/Dropbox/Alfred.alfredpreferences/workflows/user.workflow.8A46AE4B-BA25-473D-923A-63FB0A7604B3/workflow/workflow.py", line 1208, in run
    func(self)
  File "search.py", line 524, in main
    results = engine.search()
  File "search.py", line 116, in search
    results = self.wf.cached_data(key, self._suggest, max_age=600)
  File "/Users/kevinjarnot/Dropbox/Alfred.alfredpreferences/workflows/user.workflow.8A46AE4B-BA25-473D-923A-63FB0A7604B3/workflow/workflow.py", line 936, in cached_data
    data = data_func()
  File "search.py", line 402, in _suggest
    _, results = response.json()
ValueError: too many values to unpack
[ERROR: alfred.workflow.input.scriptfilter] Code 1: 10:14:07 search.py:438 DEBUG    subclass : Google
10:14:07 search.py:438 DEBUG    subclass : Google Images
10:14:07 search.py:438 DEBUG    subclass : Google Maps
10:14:07 search.py:438 DEBUG    subclass : YouTube
10:14:07 search.py:438 DEBUG    subclass : Amazon
10:14:07 search.py:438 DEBUG    subclass : eBay
10:14:07 search.py:438 DEBUG    subclass : Bing
10:14:07 search.py:438 DEBUG    subclass : Yahoo!
10:14:07 search.py:438 DEBUG    subclass : DuckDuckGo
10:14:07 search.py:438 DEBUG    subclass : Wiktionary
10:14:07 search.py:438 DEBUG    subclass : Wikipedia
10:14:07 search.py:438 DEBUG    subclass : Ask
10:14:07 search.py:111 DEBUG    key components : [u'Wikipedia', u'lang', u'en', u'query', u'bos', u'engine', u'wikipedia']
10:14:07 workflow.py:1210 ERROR    too many values to unpack
Traceback (most recent call last):
  File "/Users/kevinjarnot/Dropbox/Alfred.alfredpreferences/workflows/user.workflow.8A46AE4B-BA25-473D-923A-63FB0A7604B3/workflow/workflow.py", line 1208, in run
    func(self)
  File "search.py", line 524, in main
    results = engine.search()
  File "search.py", line 116, in search
    results = self.wf.cached_data(key, self._suggest, max_age=600)
  File "/Users/kevinjarnot/Dropbox/Alfred.alfredpreferences/workflows/user.workflow.8A46AE4B-BA25-473D-923A-63FB0A7604B3/workflow/workflow.py", line 936, in cached_data
    data = data_func()
  File "search.py", line 402, in _suggest
    _, results = response.json()
ValueError: too many values to unpack
[ERROR: alfred.workflow.input.scriptfilter] Code 1: 10:14:07 search.py:438 DEBUG    subclass : Google
10:14:07 search.py:438 DEBUG    subclass : Google Images
10:14:07 search.py:438 DEBUG    subclass : Google Maps
10:14:07 search.py:438 DEBUG    subclass : YouTube
10:14:07 search.py:438 DEBUG    subclass : Amazon
10:14:07 search.py:438 DEBUG    subclass : eBay
10:14:07 search.py:438 DEBUG    subclass : Bing
10:14:07 search.py:438 DEBUG    subclass : Yahoo!
10:14:07 search.py:438 DEBUG    subclass : DuckDuckGo
10:14:07 search.py:438 DEBUG    subclass : Wiktionary
10:14:07 search.py:438 DEBUG    subclass : Wikipedia
10:14:07 search.py:438 DEBUG    subclass : Ask
10:14:07 search.py:111 DEBUG    key components : [u'Wikipedia', u'lang', u'en', u'query', u'boston', u'engine', u'wikipedia']
10:14:07 workflow.py:1210 ERROR    too many values to unpack
Traceback (most recent call last):
  File "/Users/kevinjarnot/Dropbox/Alfred.alfredpreferences/workflows/user.workflow.8A46AE4B-BA25-473D-923A-63FB0A7604B3/workflow/workflow.py", line 1208, in run
    func(self)
  File "search.py", line 524, in main
    results = engine.search()
  File "search.py", line 116, in search
    results = self.wf.cached_data(key, self._suggest, max_age=600)
  File "/Users/kevinjarnot/Dropbox/Alfred.alfredpreferences/workflows/user.workflow.8A46AE4B-BA25-473D-923A-63FB0A7604B3/workflow/workflow.py", line 936, in cached_data
    data = data_func()
  File "search.py", line 402, in _suggest
    _, results = response.json()
ValueError: too many values to unpack
Link to comment
Quote

My system language is brazilian portuguese. When I try to search on amazon the workflow lead me to a non-existent domain (amazon.pt), however the correct brazilian domain is amazon.com.br. Could it be easily fixed?

 

Unfortunately, the Amazon sites all need to be hand-coded to get the right suggestions language, domain etc. I've added amazon.com.br in version 1.6.

 

Also added yandex.ru (Russian-language only).

 

Download from GitHub.

Edited by deanishe
Replace real name
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...