Jump to content
zhaowu

Search for typed query history

Recommended Posts

It should be easy to implement and very useful. Once you have typed lots of queries, you probably just keep repeating.

 

Do you mean a history feature for what you enter into Alfred? That's already available by pressing the up-arrow on an empty search box; it holds the last 20 items

 

Cheers :)

Share this post


Link to post
Share on other sites

Do you mean a history feature for what you enter into Alfred? That's already available by pressing the up-arrow on an empty search box; it holds the last 20 items

 

Cheers :)

Yes, but I would like to search for them. and I would like to search for more history queries. up-arrow are too slow.

Share this post


Link to post
Share on other sites

Yes, but I would like to search for them. and I would like to search for more history queries. up-arrow are too slow.

I could see it being implemented in the way clipboard history works. Perhaps even history snippets.

Share this post


Link to post
Share on other sites

Bump.

 

I could probably implement a workflow to do this provided that:

 

1. I can access the query history (currently unclear where this is stored)

2. The number of stored items (currently 20) can be customized

 

I think this would be a really useful feature

Share this post


Link to post
Share on other sites

It's not possible to search Alfred's history with a workflow because Alfred only keeps its history in memory. When you restart Alfred, the history is reset.
 
You can extract some of the information from the knowledge.alfdb file in ~/Library/Application Support/Alfred 2/Databases.
 
It's a normal sqlite3 database, and you can grab the last 20 queries with the following shell command: 

sqlite3 "$HOME/Library/Application Support/Alfred 2/Databases/knowledge.alfdb" 'SELECT keyword from knowledge WHERE hidden is NULL ORDER BY ts DESC LIMIT 20;'

To get the last 50 results, change LIMIT 20 to LIMIT 50 and so on.

 

However, this will only get you the full query (keyword + argument) for built-in actions. For workflows, only the keyword is stored in the database. If you also wanted to show the appropriate icon, you'd have to parse all installed workflows to build a UUID-icon map.

 

And it goes without saying that the database format may change at any time because it's an implementation detail and not part of the API.

 

All in all, it's probably not possible to build a particularly useful workflow to search Alfred's history.

Share this post


Link to post
Share on other sites

Curious if anything's changed since then. I'm a newcomer to Alfred and using another app, I'm used to cmd-B to show recent queries, or when executing a web search using a different shortcut to repeat the last search for example using a different search engine or site, cmd-space. Likely I haven't learned all the shortcuts yet, but it seems there are many available for future commands.

Share this post


Link to post
Share on other sites

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