Jump to content

Searchio! Auto-suggestion from search engines in different languages


Recommended Posts

  • 1 month later...
On 7/27/2016 at 6:10 PM, deanishe said:

I'll look into the problems tomorrow/Friday.

 

I can't replicate the issue at the moment because I'm running the (currently) half-baked v2 rewrite that doesn't yet support the problem engines.

 

I also need to reinstall Alfred 2 to edit the workflow to maintain compatibility.

 

Unfortunately, simply editing a workflow in Alfred 3 will make it incompatible with Alfred 2, regardless of whether you use any Alfred 3-only features :(

 

Any news about this?

Link to comment
  • 1 month later...
On 12/2/2016 at 4:37 AM, nikivi said:

Not sure if it's just me or perhaps Google changed their API but Google Maps search with autosuggestions stopped working for me.

 

0AugxDW.png 

Same for me, but for all google services (search, images, etc...). Amazon, DuckDuckGo and the others works fine so indeed maybe a problem from Google API...

Link to comment
  • 5 weeks later...
On 09/12/2016 at 10:54 PM, mickaphd said:

Same for me, but for all google services (search, images, etc...). Amazon, DuckDuckGo and the others works fine so indeed maybe a problem from Google API...

 

Google Maps API is gone. I have a working replacement using the Google Places API, but you need an API key to use that one.

 

Version 2 in the develop branch has working Google Places, but doesn't support many other engines yet, as I still haven't decided on the right data model/JSON format. Install at your own risk.

Link to comment

How can I enforce a language before I make a search?

 

For example when searching for Yandex, I want to always search in Russian there. I am nearly always in US mode and even when I am in Russian, Alfred will always enforce english language. I just want to be able to run this Yandex Search script filter in Russian language only.

 

I tried using dispatch key code combo to simulate cmd + space, before running the trigger to the script filter but the dispatch key code didn't register the key code for some reason.

 

Thank you for any help. This workflow is phenomenal. 

 

Edited by nikivi
Link to comment
  • 1 month later...
On 1/9/2017 at 0:35 PM, deanishe said:

 

Google Maps API is gone. I have a working replacement using the Google Places API, but you need an API key to use that one.

 

Version 2 in the develop branch has working Google Places, but doesn't support many other engines yet, as I still haven't decided on the right data model/JSON format. Install at your own risk.

 

Any progress with Version 2?

Link to comment

Version 2.0.0-alpha1 in the develop branch can be made to work, but it currently only supports a limited number of engines.

 

You need to add your Google Places API in the workflow configuration sheet for Google Maps to work.

 

Also, I haven't written the code to update info.plist yet, so you currently have to save searches in the workflow settings (keyword "searchio") and add the corresponding Script Filter to the workflow manually. The searches configured in the workflow when you install it will not work until you also save the corresponding searches.

 

I don't know how long it might take till an official release. I still haven't nailed down the right model for the search engine data.

Edited by deanishe
Link to comment
5 hours ago, deanishe said:

Also, I haven't written the code to update info.plist yet, so you currently have to save searches in the workflow settings (keyword "searchio") and add the corresponding Script Filter to the workflow manually. The searches configured in the workflow when you install it will not work until you also save the corresponding searches.

 

I'm not certain if I understood it, but I am getting this message:

 

uhYQnNp.png

Link to comment

The .alfredworkflow file was not version 2 but 1.8.1 when I downloaded the developer branch .zip yesterday so I had to create a new workflow on Alfred Preferences with the source with no success.

 

With the new .alfredworkflow file I could set up all searches successfully except Google Images and eBay (Google Maps aside) that seems to have a subtle different structure on Script Filter object:

 

./searchio search -e google-images -v en "$1"

 

./searchio search -e ebay -v de "$1"

For Google Images I tried ./searchio search -e google-images -v pt-br "$1", ./searchio search -e google-images-pt-br -v pt-br "$1" and some other unsuccessfully.

 

What am I missing?

Edited by xilopaint
Link to comment

UPDATE:

 

I got eBay to work with ./searchio search ebay-us "$1" but Google Images doesn't work with ./searchio search google-images-en "$1". In the latter case I am getting this:

 

[2017-03-03 00:20:41][ERROR: input.scriptfilter] Code 1: 00:20:40 workflow.py:2189 DEBUG    Workflow version : 2.0.0-alpha1
00:20:40 workflow.py:1596 DEBUG    Reading settings from `/Users/usuario/Library/Application Support/Alfred 3/Workflow Data/net.deanishe.alfred-searchio/settings.json` ...
00:20:40 workflow.py:2474 DEBUG    Update check not due
00:20:40 cli.py:62 DEBUG    args={'--help': False,
 '--version': False,
 '<args>': ['google-images-en', 'alfred'],
 '<command>': 'search'}
00:20:41 util.py:336 DEBUG    [200] https://suggestqueries.google.com/complete/search?client=firefox&ds=i&q=alfred&hl=en&safe=off
00:20:41 workflow.py:2207 ERROR    Parse error at 1:12 near token ] (])
Traceback (most recent call last):
  File "/Users/usuario/Library/Application Support/Alfred 3/Alfred.alfredpreferences/workflows/user.workflow.C313179B-50F9-4D6C-A7DF-242971F70C65/lib/workflow/workflow.py", line 2200, in run
    func(self)
  File "/Users/usuario/Library/Application Support/Alfred 3/Alfred.alfredpreferences/workflows/user.workflow.C313179B-50F9-4D6C-A7DF-242971F70C65/lib/searchio/cli.py", line 106, in cli
    return run(wf, argv)
  File "/Users/usuario/Library/Application Support/Alfred 3/Alfred.alfredpreferences/workflows/user.workflow.C313179B-50F9-4D6C-A7DF-242971F70C65/lib/searchio/cmd/search.py", line 146, in run
    results = cached_search(ctx, search, query)
  File "/Users/usuario/Library/Application Support/Alfred 3/Alfred.alfredpreferences/workflows/user.workflow.C313179B-50F9-4D6C-A7DF-242971F70C65/lib/searchio/cmd/search.py", line 127, in cached_search
    return ctx.wf.cached_data(key, _search, max_age=MAX_CACHE_AGE)
  File "/Users/usuario/Library/Application Support/Alfred 3/Alfred.alfredpreferences/workflows/user.workflow.C313179B-50F9-4D6C-A7DF-242971F70C65/lib/workflow/workflow.py", line 1833, in cached_data
    data = data_func()
  File "/Users/usuario/Library/Application Support/Alfred 3/Alfred.alfredpreferences/workflows/user.workflow.C313179B-50F9-4D6C-A7DF-242971F70C65/lib/searchio/cmd/search.py", line 104, in _search
    jx = parse(search.jsonpath)
  File "/Users/usuario/Library/Application Support/Alfred 3/Alfred.alfredpreferences/workflows/user.workflow.C313179B-50F9-4D6C-A7DF-242971F70C65/lib/jsonpath_rw/parser.py", line 14, in parse
    return JsonPathParser().parse(string)
  File "/Users/usuario/Library/Application Support/Alfred 3/Alfred.alfredpreferences/workflows/user.workflow.C313179B-50F9-4D6C-A7DF-242971F70C65/lib/jsonpath_rw/parser.py", line 32, in parse
    return self.parse_token_stream(lexer.tokenize(string))
  File "/Users/usuario/Library/Application Support/Alfred 3/Alfred.alfredpreferences/workflows/user.workflow.C313179B-50F9-4D6C-A7DF-242971F70C65/lib/jsonpath_rw/parser.py", line 55, in parse_token_stream
    return new_parser.parse(lexer = IteratorToTokenStream(token_iterator))
  File "/Users/usuario/Library/Application Support/Alfred 3/Alfred.alfredpreferences/workflows/user.workflow.C313179B-50F9-4D6C-A7DF-242971F70C65/lib/ply/yacc.py", line 331, in parse
    return self.parseopt_notrack(input, lexer, debug, tracking, tokenfunc)
  File "/Users/usuario/Library/Application Support/Alfred 3/Alfred.alfredpreferences/workflows/user.workflow.C313179B-50F9-4D6C-A7DF-242971F70C65/lib/ply/yacc.py", line 1199, in parseopt_notrack
    tok = call_errorfunc(self.errorfunc, errtoken, self)
  File "/Users/usuario/Library/Application Support/Alfred 3/Alfred.alfredpreferences/workflows/user.workflow.C313179B-50F9-4D6C-A7DF-242971F70C65/lib/ply/yacc.py", line 193, in call_errorfunc
    r = errorfunc(token)
  File "/Users/usuario/Library/Application Support/Alfred 3/Alfred.alfredpreferences/workflows/user.workflow.C313179B-50F9-4D6C-A7DF-242971F70C65/lib/jsonpath_rw/parser.py", line 69, in p_error
    raise Exception('Parse error at %s:%s near token %s (%s)' % (t.lineno, t.col, t.value, t.type))
Exception: Parse error at 1:12 near token ] (])
00:20:41 workflow.py:2210 INFO     For assistance, see: https://github.com/deanishe/alfred-searchio/issues
00:20:41 workflow.py:2231 DEBUG    Workflow finished in 0.386 seconds.
Link to comment

The engine definition is incorrect for Google Images (as noted, I haven't finished finalising the definition format yet). The simplest fix is to correct the google-images.json file in the workflow itself at lib/searchio/engines/google-images.json. Remove the json_path key from that file and re-save the Google Images (English) search (you may have to delete the existing one first) to ensure the search definition is correct.

Link to comment
7 hours ago, PebaVermelho said:

For Google Images I tried ./searchio search -e google-images -v pt-br "$1", ./searchio search -e google-images-pt-br -v pt-br "$1" and some other unsuccessfully.

 

At lot of the searches in the workflow are left over from version 1 and thus have this old calling format. You must use the format ./searchio search google-images-pt-br "$1".

 

The search ID is the same as the filename of its definition, and they're saved in ~/Library/Application Support/Alfred 3/Workflow Data/net.deanishe.alfred-searchio

Link to comment
10 hours ago, deanishe said:

The engine definition is incorrect for Google Images (as noted, I haven't finished finalising the definition format yet). The simplest fix is to correct the google-images.json file in the workflow itself at lib/searchio/engines/google-images.json. Remove the json_path key from that file and re-save the Google Images (English) search (you may have to delete the existing one first) to ensure the search definition is correct.

 

It worked. Thank you!

Link to comment
  • 1 month later...
  • 4 weeks later...
On 1/9/2017 at 0:35 PM, deanishe said:

 

Google Maps API is gone. I have a working replacement using the Google Places API, but you need an API key to use that one.

 

Version 2 in the develop branch has working Google Places, but doesn't support many other engines yet, as I still haven't decided on the right data model/JSON format. Install at your own risk.

 

I have been using version 2 and got a key for Google Places API Web Service, but the search doesn't take my location into account, so I have to type my city's name. Is this the expected behavior?

Link to comment
1 hour ago, xilopaint said:

Is this the expected behavior?

 

Not precisely. From the API docs:

 

Quote

If you do not supply the location and radius, the API will attempt to detect the user's location from their IP address, and will bias the results to that location.

 

https://developers.google.com/places/web-service/autocomplete#location_biasing

 

So, it should prefer results near to you.

 

It is possible to specify a location and radius. I guess I could add those as options in the configuration sheet if the geolocation via IP address sucks. 

 

 

Link to comment

I've looked into this, and setting a location and radius for the Place search should get you the results you want.

 

I've pushed an updated version to the develop branch with GOOGLE_PLACES_LOCATION and GOOGLE_PLACES_RADIUS options in the workflow configuration sheet. You must set both for it to work, and the location must be in decimal format, e.g. 51.450833,7.013056, and the radius is in metres.

 

You must also delete your existing search and re-add it (or edit the config by hand to add the parameters to the URL). You can delete the search via the searchio command (it shows an error, as the feature isn't complete, but it does delete the configuration), or you can remove it by hand by entering searchio workflow:opendata and removing the corresponding file(s) from the searches directory.

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