Jump to content

Seeking suggestions on sharing Custom Web Searches


Recommended Posts

I have a bunch of Custom Web Searches and would like to publish them online and make it easy for people to install them. I have some ideas on how I might go about doing this, but it seems like it'll be pretty inefficient for others to install them in a batch. 

 

  1. I don't suppose there's an easy way to import or export all of your custom web searches?
  2. Additionally, I like adding custom icons to each search... but when I copy the URL for sharing, the icon is left out. There's no way to fix that (i.e. binary encode the image in the sharing URL) is there?
Link to comment

Have you tried https://github.com/nikitavoloboev/alfred-web-searches

I will try to push an update for support of truly custom searches. But the idea behind the workflow is that is that it searches over a list of searches defined here (https://github.com/nikitavoloboev/alfred-web-searches/blob/master/workflow/websites.csv)

 

As example, here is a line in the csv file

`

Pinboard,https://pinboard.in/search/?query={query}&all=Search+All
`

 

Then you search for Pinboard in workflow

 

image.thumb.png.3eb6b31517402e9a8ee93fa064eeef5d.png

 

And on return you start typing query, that query will be what will be placed in {query} exactly the same as what alfred allows.

 

image.thumb.png.1eb4f6863daaa2f30241bb8198e03df2.png

 

I use it all the time but didn't get to making it more user friendly to other contributions in case you don't want to use any of the 500 searches defined that come with workflow I want to allow users to have custom lists.

 

Also now that I am typing this out, Alfred allows you to create keywords for each of the queries (forces you too actually). Would be nice to solve this use case too perhaps. 


The only way I see how to solve it is to generate Alfred objects in similar way that https://github.com/deanishe/alfred-searchio does. Don't see any other way.

 

But if you do want to have many custom searches with unique keyword, workflow will get big (many objects generated) and thus slow to use.

 

Actually never mind all that, I have a solution that doesn't require object generation. Create hotkey blocks that send a keyword like `PInboard` and the workflow will know what to do with it. Will try to solve this and let you know @chris as I believe it should solve the issue you have nicely. Alfred web searches are way too limiting and require too much friction in creating a new search. Web Searches allows creating a new search by opening a file (have it bound to km macro) and adding one line.  

 

Edited by nikivi
Link to comment

Let me know if you do try web searches though, would love to hear your thoughts on how I can improve it :)


One other thing I want to add is starting off with a Searchio query powered by google and on return passing that query to web searches so you can do google powered queries on any of the websites on the internet. But that would require porting the Searchio core or submitting PR to Searchio for exposing the result in Searchio itself. Not too sure tbh

Edited by nikivi
Link to comment
3 hours ago, chris said:

it'll be pretty inefficient for others to install them in a batch.

 

Why do you think other people would want to install all of them?

 

3 hours ago, chris said:

There's no way to fix that (i.e. binary encode the image in the sharing URL) is there?

 

No. A URL needs to be under ~2000 characters to work reliably across browsers.

 

If icons and batch import are important to you, then you can add them directly to the Alfred.alfredpreferences bundle.

Edited by deanishe
Link to comment

@chris have you considered creating a workflow of multiple Keyword Input -> Open URL Action object pairs instead of using the Custom Web Search feature? This is essentially what built-in custom web searches are doing under the hood.

 

If you set a bundle id on the workflow, then sharing a new version of your workflow with added or altered urls will update the currently installed workflow and also maintain any keywords people have altered within the workflow.

 

Using this method will also retain the image you've set for the custom searches.

 

Side note: In the Open URL Action, there is a "Custom Search" button to the right of the URL field to pull in a custom URL you've created.

 

Side note 2: If you create one empty Keyword Input -> Open URL Action pair, you can copy and paste it many times to save time adding each pair manually.

 

Cheers,

Andrew

Link to comment
8 hours ago, Andrew said:

@chris have you considered creating a workflow of multiple Keyword Input -> Open URL Action object pairs instead of using the Custom Web Search feature? This is essentially what built-in custom web searches are doing under the hood.

 

If you set a bundle id on the workflow, then sharing a new version of your workflow with added or altered urls will update the currently installed workflow and also maintain any keywords people have altered within the workflow.

 

Using this method will also retain the image you've set for the custom searches.

 

Ah, this is great! 

 

What I'm struggling with are the tensions between:

  • discrete shareability — making it easy to share individual custom searches
  • maintainability — making it easy for people to add/remove custom searches that they've made/discovered given that OpenSearch metadata seems to be in decline
  • convenience — I really like how I can use a CSV to update a List Filter. The method you suggested means creating individual workflow objects for each search (or copying and pasting, like you suggested, which I'll likely end up doing). I don't mind this, but was looking for something a little more efficient to begin with. No biggie.

I do appreciate @nikivi's Alfred Web Searches Workflow, but being sensitive to visual appearances, I would prefer that it supported unique icons for each service (makes it easier for me to visually target my intended search endpoint).

 

I might produce an Airtable database with Custom Searches that automatically composes alfred:// install links and offers downloadable icons (which I will make). This will also allow me to create a form to accept new submissions/suggestions/requests.

 

Just wanted to check if there was another way to manipulate the Custom Searches in a more efficient way before I dove into that! Thanks! 

Link to comment

@chris Have you looked at Searchio!?

 

It's basically what you're describing, only it's for providing search suggestions from different search engines, not just generating search URLs. It's fairly simple to add custom search engines or specific searches, including your own icons.

 

It doesn't do what you're trying to do, but it's probably worth looking at because it covers all three of your bullet points.

Link to comment
2 hours ago, deanishe said:

@chris Have you looked at Searchio!?

 

It's basically what you're describing, only it's for providing search suggestions from different search engines, not just generating search URLs. It's fairly simple to add custom search engines or specific searches, including your own icons.

 

Ok nice — took a look and yes, this seems directionally where I want to go! 

 

I read your docs but I'm a little confused about the Adding Engines directions. I've opened up the /engines folder and presume that I add an individual .json file for each additional search I want to add? Does the filename matter? (I see that the icon and search file names do need to match)

Edited by chris
Edited now that I read the docs!
Link to comment
1 hour ago, chris said:

I've opened up the /engines folder and presume that I add an individual .json file for each additional search I want to add?

 

Not exactly. Engines (in the workflow's terminology) are collections of searches ("variants"), typically different regional/language versions for a single site. You could also use engines to group searches by topic.


The configuration files for the individual searches you add to the workflow are in the searches directory in the workflow’s data folder.

 

If you add a new engine, it shows up in the workflow’s settings (from where you can add/remove searches). If you add a new search configuration, a new Script Filter will be created for it next time you run searchio > Reload.

 

1 hour ago, chris said:

Does the filename matter? (I see that the icon and search file names do need to match)

 

Yes. The filename is the engine’s ID. Search configurations are named <engineID>-<UID>.

 

As you've noticed, the engine's icon needs to have the same name as the engine. If you don't follow the search config naming scheme, the search won't show up as already installed in the settings.

 

All that said, if you don’t want the auto-suggestion feature, I think the way my Suffix Web Search workflow works is more useful. You enter your search query first, and then choose the site to search from the list.

 

Link to comment
23 minutes ago, deanishe said:

 

Not exactly.

 

 

Ok, I read through your comments and I'm still missing something. I don't mean to be daft, but a real example would be super helpful to get me started.

 

So for example, I have a Custom Search for Chrome Extensions.

 

What files with what content would I need to create to add this and the attached icon to the Searchio Workflow Data folder? 

 

Title: Search Chrome Extensions for {query}
Search URL: https://chrome.google.com/webstore/search/{query}?hl=en-US&_category=extensions
Keyword: extensions

 

Thanks!

CleanShot 2020-09-17 at 16.14.21.png

Link to comment
10 hours ago, chris said:

I don't mean to be daft, but a real example would be super helpful to get me started.

 

Install the workflow, add some searches, and then look at the configuration files created in the searches subdirectory of the data directory.

 

I can't give you a more real-world example than that.

 

Edited by deanishe
Link to comment
On 9/18/2020 at 2:23 AM, deanishe said:

Install the workflow, add some searches, and then look at the configuration files created in the searches subdirectory of the data directory.

 

I can't give you a more real-world example than that.

 

Ah! Fair enough! Here's the problem I keep running into though... so little support for OpenSearch! 

 

image.png.c195f1c2c6e6a934f3969c706f626317.png

I was able to use Quora to create a custom search though, I so I may have enough to get started... but why did it put the icon in a [seemingly] random location (I expected the icon to be in ~/Library/Alfred/Workflow Data/net.deanishe.alfred-searchio/icons)?

 

{
  "icon": "/Users/messina/Dropbox/Alfred/Alfred.alfredpreferences/workflows/user.workflow.51A5FA2A-E885-40D1-BA84-6270978DBFFE/icon.png",
  "jsonpath": "$[1][*]", 
  "keyword": "quora",
  "search_url": "http://www.quora.com/opensearch/query?q={query}&pw={startPage?}",
  "suggest_url": "http://www.quora.com/opensearch/suggest?q={query}",
  "title": "Quora"
}

 

Link to comment
10 hours ago, chris said:

Here's the problem I keep running into though... so little support for OpenSearch!

 

The workflow requires OpenSearch Autosuggest support (because that’s the whole point). OpenSearch search is much more widely supported.

 

10 hours ago, chris said:

but why did it put the icon in a [seemingly] random location

 

It hasn't put any icon anywhere. I'm sure you can figure out which directory that is, and why the workflow is using that icon.

Link to comment
5 hours ago, deanishe said:

The workflow requires OpenSearch Autosuggest support (because that’s the whole point). OpenSearch search is much more widely supported.

 

Ohhh... ok, this makes more sense. I didn't realize that:

  1. OpenSearch has two flavors: URL-based search OR autosuggest (I had only used OpenSearch discovery in Alfred for the former)
  2. That Searchio is intended to target returning search suggestions within Alfred!

Now I get the power of Searchio — and also why it may complement my goals in sharing my Custom Searches.

 

For me, the beauty of Custom Searches is that it makes it easy to quickly open URLs in the browser with an arbitrary {query} string — which of course can be used to execute a search.

 

I also use Custom Searches to go to user profiles though, i.e. if I supply a username as the query and append it to a well-known URL (i.e. https://twitter.com/@{query}). It seems like this use case wouldn't be well served by Searchio. Do you agree with this assessment, @deanishe?

Link to comment
13 minutes ago, chris said:

URL-based search OR autosuggest (I had only used OpenSearch discovery in Alfred for the former)

 

Not quite. It always has search (otherwise autosuggest wouldn't make much sense). But Searchio! only supports sites that also provide autosuggest.

 

14 minutes ago, chris said:

That Searchio is intended to target returning search suggestions within Alfred!

 

Have you not actually used the workflow?

 

14 minutes ago, chris said:

It seems like this use case wouldn't be well served by Searchio.

 

No, it wouldn't. Unless there's an autosuggest URL.

 

The point is, Searchio! would provide a good basis for your sharing-custom-searches idea. It already supports adding (collections of) searches via its engine config files. It supports custom search icons. And users choose for themselves which searches are actually activated.

 

Modifying it for your purposes would mostly consist of ripping the autosuggest bits out. The ability to insert a query into an arbitrary URL à la custom websearches is necessarily already there.

 

Or you could use it as-is (with a different name and bundle ID, of course), and just use the Google autosuggest URL for every search.

Link to comment

Ok, I've made some progress thanks to the wonder of Pory, and new Airtable-backed No Code website builder! 

 

I haven't added all of my searches yet, but that's because I'm making custom icons for each of them before revealing them. You can find them here — and you can install a Custom Search just by clicking on the button.

 

Visit 🎩  Alfred Custom Searches

 

Here's a preview (the template is a bit meh, but it's functional!):

 

image.thumb.png.245de57c4636614aab4c336286087d47.png

Thanks for your help @deanishe!

Link to comment
  • 6 months later...

Very interesting! Similarly, I combined all the custom searches in a single workflow, but I was wondering if there is a way to combine them with pinboard bookmarks?

In other words, a single workflow in which Alfred searches across all bookmarks (including custom searches), and if one of them is a custom search, Alfred will expect a {query} argument? 

 

 

Link to comment
2 hours ago, giovanni said:

Very interesting! Similarly, I combined all the custom searches in a single workflow, but I was wondering if there is a way to combine them with pinboard bookmarks?

In other words, a single workflow in which Alfred searches across all bookmarks (including custom searches), and if one of them is a custom search, Alfred will expect a {query} argument? 

 

You could just add a keyword object that outputs to a custom search (as in the section row here):

 

image.thumb.png.25d5fa29adf91dd2856c80a90770ce29.png

Link to comment
54 minutes ago, giovanni said:

I will keep pinboard search and custom search separate for now :) .

 


Bear in mind that you can assign the same keyword to multiple Workflows and see the search results from all of them at the same time.

 

55 minutes ago, giovanni said:

too bad github does not support Open Search 😄


 :D 

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