Skip to content

Commit

Permalink
Add option to append query to results #33
Browse files Browse the repository at this point in the history
  • Loading branch information
deanishe committed Dec 13, 2017
1 parent 46654cb commit 2172cb9
Show file tree
Hide file tree
Showing 10 changed files with 812 additions and 458 deletions.
20 changes: 19 additions & 1 deletion README.md
Expand Up @@ -14,6 +14,8 @@ Contents
- [Download and installation](#download-and-installation)
- [Usage](#usage)
- [Configuration](#configuration)
- [Workflow Configuration Sheet](#workflow-configuration-sheet)
- [In-Workflow Configuration](#in-workflow-configuration)
- [Importing Searches](#importing-searches)
- [Adding Engines](#adding-engines)
- [Licensing, thanks](#licensing-thanks)
Expand Down Expand Up @@ -62,14 +64,30 @@ There are several example searches pre-configured:
<a name="configuration"></a>
### Configuration ###

There is a single variable in the workflow configuration screen (open the workflow in Alfred Preferences and hit the `[𝒙]` button): `GOOGLE_PLACES_API_KEY`. You must set this to use Google Maps search. You can get an API key [here](https://developers.google.com/places/web-service/get-api-key).
The workflow is configured via the `searchio` keyword and some [workflow variables](https://www.alfredapp.com/help/workflows/advanced/variables/) set in the workflow configuration sheet.


<a name="workflow-configuration-sheet"></a>
#### Workflow Configuration Sheet ####

There are some variables in the workflow configuration screen (open the workflow in Alfred Preferences and hit the `[𝒙]` button):

| Name | Description |
|-------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `GOOGLE_PLACES_API_KEY` | You must set this to use Google Maps search. You can get an API key [here](https://developers.google.com/places/web-service/get-api-key). |
| `SHOW_QUERY_IN_RESULTS` | Set to `1` or `yes` to always append the entered query to the end of the results (so you can hit `` to select it). If unset (or set to `0` or `no`), the query will only be shown if there are no other results. |


<a name="in-workflow-configuration"></a>
#### In-Workflow Configuration ####

- `searchio [<query>]` — Show workflow settings
- `Update Available …` — Shown if there is a new version of the workflow available to download. Action the item to install it.
- `Installed Searches …` — View and delete your configured searches
- `All Engines …` — View supported engines and add new searches
- `Import Search …` — Import a new search configuration from a URL (see [Importing Searches](#importing-searches))
- `Reload` — Regenerate the workflow's Script Filters from your configured searches (and clean the cache). Run this if you screw up the Script Filters or an update overwrites them.
- `Show Query in Results` — Turn the option to show the query you entered in the results on/off. The query is added to the end of the results, so you can hit `` to go straight to it. The query is always shown if there are no other results.
- `Online Help` — Open this page in your browser.
- `Workflow up to Date` — You have the latest version of the workflow. Action this item to force a check for a new version.

Expand Down
54 changes: 27 additions & 27 deletions extra/Benchmark.ipynb
Expand Up @@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "code",
"execution_count": 9,
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -26,17 +26,17 @@
},
{
"cell_type": "code",
"execution_count": 10,
"execution_count": 6,
"metadata": {},
"outputs": [],
"source": [
"REPS = 10\n",
"QUERY = 'quim'"
"QUERY = 'quimby'"
]
},
{
"cell_type": "code",
"execution_count": 11,
"execution_count": 7,
"metadata": {
"scrolled": true
},
Expand All @@ -45,51 +45,51 @@
"name": "stdout",
"output_type": "stream",
"text": [
"01. 0.664s\n",
"02. 0.343s\n",
"03. 0.351s\n",
"04. 0.340s\n",
"05. 0.368s\n",
"06. 0.392s\n",
"07. 0.343s\n",
"08. 0.338s\n",
"09. 0.343s\n",
"10. 0.360s\n",
"01. 0.941s\n",
"02. 0.333s\n",
"03. 0.316s\n",
"04. 0.323s\n",
"05. 0.306s\n",
"06. 0.346s\n",
"07. 0.396s\n",
"08. 0.327s\n",
"09. 0.314s\n",
"10. 0.341s\n",
"---------------\n",
"0.384s/run\n"
"0.394s/run\n"
]
}
],
"source": [
"bench(['./searchio', 'search', 'google-en', QUERY], REPS)"
"bench(['../src/searchio', 'search', 'google-en', QUERY], REPS)"
]
},
{
"cell_type": "code",
"execution_count": 12,
"execution_count": 8,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"01. 0.347s\n",
"01. 0.348s\n",
"02. 0.033s\n",
"03. 0.025s\n",
"04. 0.024s\n",
"05. 0.025s\n",
"06. 0.024s\n",
"07. 0.027s\n",
"03. 0.026s\n",
"04. 0.032s\n",
"05. 0.024s\n",
"06. 0.026s\n",
"07. 0.025s\n",
"08. 0.025s\n",
"09. 0.025s\n",
"10. 0.026s\n",
"09. 0.029s\n",
"10. 0.028s\n",
"---------------\n",
"0.058s/run\n"
"0.060s/run\n"
]
}
],
"source": [
"bench(['./search', 'google-en', QUERY], REPS)"
"bench(['../src/search', 'google-en', QUERY], REPS)"
]
}
],
Expand Down
1 change: 1 addition & 0 deletions src/icons/icons.txt
Expand Up @@ -15,6 +15,7 @@

# Workflow icons
icon elusive D0141C search-alt
searches-active elusive 1B981B search-alt

update-available material FDAC27 cloud-download
update-check material 1B981B cloud-download
Expand Down
Binary file added src/icons/searches-active.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 2172cb9

Please sign in to comment.