Jump to content

Browser History Search


Recommended Posts

This is pretty straightforward feature request.

 

Since Alfred 3.5 there is an ability to search through your browser bookmarks. It's super nice, except it is only bookmarks. Wouldn't it be awesome to search through entire browser history in addition to bookmarks? This is how pretty much all modern browsers search bars are working, and there is a reason for that, it's really useful and convenient, considerably speeding up the time you need to enter URL.

 

Right now, I often find myself going back to enter URLs/search in Safari, shy away of using Alfred for this type of functionality, since there are more relevant suggestions when I'm using Safari.

Edited by schrodinger_cat
Link to comment
Share on other sites

Indeed, I'm aware of this workflow.

 

I should've clarified, I'm suggesting to add this functionality as a native built-in feature similar to Bookmarks Search added in Alfred 3.5 in order to consolidate both Bookmarks and History search results in one query.

 

P.S.

Sorry, I haven't manage to find similar requests for some reason:wacko:

Edited by schrodinger_cat
Link to comment
Share on other sites

2 hours ago, schrodinger_cat said:

I'm suggesting to add this functionality as a native built-in feature similar to Bookmarks Search added in Alfred 3.5

 

Why does it matter that it's native?

 

High Sierra removed Safari's exported bookmarks and history data, so you can no longer include them in Alfred's default search results (at least, not without jumping through a lot of hoops). As a result, you have to use a keyword, which means there's no practical difference between a native feature and one provided by a workflow.

 

And while I don't speak for the Alfred team, I think that native history search is unlikely to be added. It wasn't a feature of earlier versions when Safari's history data were officially available, so I don't expect Andrew will add it now that the data are private and contained in one of Safari's internal databases.

 

The new bookmark search also involves accessing a private Safari file, but importantly, that is to maintain an existing feature. Sensible developers tend not to add new features that rely on the internal data of other software.

 

2 hours ago, schrodinger_cat said:

in order to consolidate both Bookmarks and History search results in one query.

 

That's a different question altogether. If that's your goal, why don't you post a request for a workflow in the Workflow Help & Questions forum?

Edited by deanishe
Link to comment
Share on other sites

12 hours ago, deanishe said:

Why does it matter that it's native?

 

Well, it doesn't, mostly, except, correct me if I'm wrong, it's the only way to get items in default results without using keyword. Perhaps, somehow allowing to add output from workflow to default results would be a better and more unified solution? But as far as I understand, this is much harder to do.

 

It's just struck me as strange, that you can search through Bookmarks natively but not History. Now, though, when you explained hoops you need to jump through in order to make this work, this makes much more sense.

 

12 hours ago, deanishe said:

That's a different question altogether. If that's your goal, why don't you post a request for a workflow in the Workflow Help & Questions forum?

 

My goal is to replicate how search bars in modern browsers are working. You can type beginning of URL or website name, and get search in Bookmarks, History (and search engine suggestions, but this is another matter). Alfred can do this all, but it's fragmented. It's not some exotic, highly specialised functionality, almost every user needs this. This is why it's seems logical to me to add this as a native feature.

 

I admit, maybe all of this against philosophy of how Alfred is built, and I should train myself to use different keywords for different purposes instead of throwing everything into one pile, like browser search bar and spotlight are doing.

Edited by schrodinger_cat
Link to comment
Share on other sites

36 minutes ago, schrodinger_cat said:

Perhaps, somehow allowing to add output from workflow to default results would be a better and more unified solution?

 

That idea has been suggested a few times.

 

For one, it goes against Alfred’s design of calling things purposefully. But more importantly, some Workflows are complex and require several seconds to run. Running every Workflow at once to give results would not only create a mess or results, it’d kill performance.

Link to comment
Share on other sites

9 minutes ago, schrodinger_cat said:

it's the only way to get items in default results without using keyword

 

You're absolutely right. I thought that option had been removed and bookmark search was now keyword only, but I was wrong.

 

10 minutes ago, schrodinger_cat said:

that you can search through Bookmarks natively but not History

 

With Sierra and earlier, you could add history to your default results, as Safari exported its history (and bookmarks) to a bunch of files. As such, you could add that filetype to your defaults.

 

I don't think it was a built-in option for the simple reason that Safari keeps a lot of history items. Many tens of thousands. That many items could make the default search much slower and less useful.

 

13 minutes ago, schrodinger_cat said:

Alfred can do this all, but it's fragmented. It's not some exotic, highly specialised functionality, almost every user needs this.

 

Again, sorry. I thought it was no longer possible to add bookmarks to default results.

 

Yeah, it's of interest to many, if not most, users. But that's not the same as being something that should be integrated with Alfred's default search results. As noted above, there are a huge number of history items, and they could potentially overwhelm everything else.

 

As you've probably noticed, Alfred strongly encourages you to limit its default results to a very small set to keep search fast and results relevant. Alfred is designed to use "fragmented", i.e. focussed, searches. That's what gives it its speed an accuracy.

 

You've probably noticed that it can be difficult enough finding the file or folder you want with a File Filter when there are several dozen (semi-)matching results. Dropping 50K history items into the default search will give you the same problem there, only worse, overwhelming applications, contacts, bookmarks etc. (Imagine trying to find "Google Chrome" or a "Google" bookmark when there are 3000 google.com history items.)

 

As such, I think it's very unlikely that Alfred will gain the ability to add Safari (or Chrome) history to its defaults.

 

I'd actually not thought about combining bookmarks and history. I'm currently working on a Safari workflow. I'll look at adding a combined search that covers bookmarks and the last few thousand history items.

Link to comment
Share on other sites

14 minutes ago, vitor said:

it’d kill performance

 

Yeah. Even the very fastest workflows written in compiled languages are noticeably slower than native searches (if only by a little bit). It's unavoidable due to the way Alfred runs workflows.

 

Most workflows are written in interpreted languages, however, and they are 20x slower than native search in the best cases. Often 100x slower.

Link to comment
Share on other sites

23 hours ago, vitor said:

But more importantly, some Workflows are complex and require several seconds to run. Running every Workflow at once to give results would not only create a mess or results, it’d kill performance.

 

There no need to assign every workflow to default results, though. It's for the user to decide, if he wants trade some performance for convenience of getting workflow output in default results. User absolutely can kill Alfred performance already:

 

23 hours ago, deanishe said:

As you've probably noticed, Alfred strongly encourages you to limit its default results to a very small set to keep search fast and results relevant.

 

This is more strong argument against it, I think:

 

23 hours ago, deanishe said:

Alfred is designed to use "fragmented", i.e. focussed, searches. That's what gives it its speed an accuracy.

 

Maybe, as it often happens, I confused habit with convenience. I'll try to use everything separately for now, with different keyword and not messing up default results.

 

23 hours ago, deanishe said:

I'm currently working on a Safari workflow. I'll look at adding a combined search that covers bookmarks and the last few thousand history items.

 

Thank you! This is no doubt would be useful, even when trying to use everything separate, since I, and I suspect, many other users, don't always remember if the URL in question was added as a bookmark or not.

Link to comment
Share on other sites

6 minutes ago, schrodinger_cat said:

It's for the user to decide, if he wants trade some performance for convenience of getting workflow output in default results.

 

And it’s then up to the Alfred team to answer dozens of bug reports of “Alfred is slow” when it was the user’s fault.


That already happens. There are a ton of duplicates on the forum about Alfred being slow on High Sierra, all of them with the same cause: themes with blur which are a default feature. That is but one (the most recent) example. Alfred caters to both power users and newbies, and the latter tends to shoot themselves on the foot1and not searching before asking2. That combination leads to a lot of duplicate bug reports, and for the maintainers wasted time and frustration (and eventually burnout).



1. Not a criticism; that’s how we learn.
2. That is indeed a criticism. No real excuse for that, though we may all do it occasionally.
 
Link to comment
Share on other sites

2 hours ago, schrodinger_cat said:

I'll try to use everything separately for now, with different keyword and not messing up default results.

 

It's "The Alfred Way", tbh. It's what sets Alfred apart from Spotlight in terms of searching. If you try combine everything in one single search, you just end up turning Alfred into an equally slow but slightly more purple version of Spotlight.

 

2 hours ago, schrodinger_cat said:

This is no doubt would be useful, even when trying to use everything separate, since I, and I suspect, many other users, don't always remember if the URL in question was added as a bookmark or not.

 

Thanks for volunteering as a beta tester ;)

 

Here's the workflow. Here are the usage instructions. Feedback would be appreciated, especially a suggestion for a good name for the workflow.

Link to comment
Share on other sites

Hey @deanishe


Thank you for updating Safari Assistant. It's even more awesome now. I have a question about bookmarklets though. How do you actually add them to Safari? Since they are Javascript code, I always ran them from Keyboard Maestro like so :

 

2TxlHH2.png


But I think it would be quite awesome if I could save them inside of Safari, I couldn't really find how though. I only really use the above bookmarklet and this one.


As for workflow comments, my only wish is if you could add external triggers for : 
1. view safari tabs
2. searching bookmarks
3. searching history

 

And to add a modifier keypress on searching current tabs (⌃ + ⏎ since ⌘ goes to tab actions) to close the tab. Often this is my most used tab action from the bunch and it would save me quite a bit of time if it existed. I can submit a PR too as I think I understand how to add it for myself. Without it, this modifier change alongside my external triggers would get wiped on updates which is a shame.

 

Oh and I think Safari Assistant is pretty good name. I can't really think of a better one. Thanks for sharing the workflow. ? 

Edited by nikivi
Link to comment
Share on other sites

I also I think I found a `bug` that I think didn't exist in previous version. If I search for : 

lcaXgTH.png 

 

As you can see `Learn Anything Introduction` is one of the results there : 

 

However with this search :

HZFdUkd.png 

 

I get no results. This however does return correct results : 

PI0OMzg.png 

Perhaps I misunderstand how the fuzzy algorithm works but I would think the second should return the same results as well.

 

Although now that I have tested it with other queries too. It seems that History search does not implement fuzzy searching. If that is the case, then you can add that to the above list as feature request. ?

 

Fortunately a File Filter Workflow Andrew shared before does actually have fuzzy searching :

 

PaokEHD.png 

 

So I can use that.

Edited by nikivi
Link to comment
Share on other sites

4 hours ago, nikivi said:

How do you actually add them to Safari?

 

  1. Drag a bookmarklet from a webpage to your bookmarks bar then move it from there, or
  2. Create a random bookmark, then edit it and change the URL to your bookmarklet JavaScript.

 

3 hours ago, nikivi said:

I also I think I found a `bug`

 

I'm pretty sure you haven't. See below.

 

3 hours ago, nikivi said:

Perhaps I misunderstand how the fuzzy algorithm works

 

Yeah, I'd say you haven't understood how the workflow works, as it isn't actually explained in the README yet.

 

The old version of the workflow that you have also uses a File Filter for Safari's history (exactly the same as Andrew's workflow, which doesn't support "real" fuzzy search).

 

The problem is, the history files have gone away in High Sierra, so using a File Filter no longer works. As a result, the new version linked above uses Safari's sqlite3 history database, but in two different ways for performance reasons.

 

It would be far too slow to load all the entries from the database (mine has ~55K rows), and the fuzzy search doesn't handle that many items very well either, so the history search (keyword hi) uses an SQL query to search the database (LIKE '%{query}%') and only loads the results. SQL search is not fuzzy.


The combined bookmark and history search (keyword bh) does use fuzzy search, but it only loads the last 1000 entries from your history (by default), and de-duplication often halves the actual number of entries. (This should be obvious from the logs.)


You can adjust that number in the workflow configuration sheet. I deliberately set it fairly low by default to keep the Script Filter fast. Even with only 1000 history items, it's significantly slower than the pure bookmark search (keyword bm). You'll have to find the right number for your own preferences/usage.

 

Edited by deanishe
Link to comment
Share on other sites

20 hours ago, nikivi said:

my only wish is if you could add external triggers for

 

Not unless someone has a use-case better than "I launch my workflows in a weird way".

 

20 hours ago, nikivi said:

And to add a modifier keypress on searching current tabs

 

You haven't even looked at the configuration or read the README, have you?

 

Please, Niki, stop making posts about my workflows until you've at least read the damn instructions.

 

Link to comment
Share on other sites

1 hour ago, deanishe said:

You haven't even looked at the configuration or read the README, have you?

Only after I posted the message. ?

 

I didn't expect you could even have such customisability without modifying the code beforehand. This is really quite amazing. And yeah, sorry for another uninformed question. 

 

I hope to implement something cool with AwGo too soon.

 

1 hour ago, deanishe said:

Not unless someone has a use-case better than "I launch my workflows in a weird way".

 

You should really try out Karabiner. Given you are still on El Captain, you still can. Might change your world. So at least give it a try.

 

If you do, you might hopefully understand why it is not "weird" calling workflows in this way. And I won't be alone in adding these triggers for everything.

 

 

Edited by nikivi
Link to comment
Share on other sites

If you get some time. Just try this. Assuming you are on El Captain.

 

Download Karabiner. Open Karabiner Preferences.

 

Then in Misc & Unistall tab, click this to open private.xml :

 

ns3HhKF.png 

 

And add this code there :

 

<?xml version="1.0"?>
<root>
    
</url>
</vkopenurldef>
<vkopenurldef>
<name>KeyCode::VK_OPEN_URL_ALFRED_SEARCH_GOOGLE</name>
<url type="shell">
osascript -e '
tell application "Alfred 3" to run trigger "google" in workflow "net.deanishe.alfred-searchio" with argument ""
'
</url>
</vkopenurldef>
<item>
<name>general: sim jk = google</name>
<identifier>private.sim_jk_google</identifier>
<autogen>
__SimultaneousKeyPresses__
KeyCode::J, KeyCode::K,
KeyCode::VK_LOCK_ALL_FORCE_OFF,
KeyCode::VK_OPEN_URL_ALFRED_SEARCH_GOOGLE
</autogen>
</item>
</root>

 

And install the modified version of Searchio that has the triggers. 

 

Then reload Karabiner here : 

QtOXIIh.png 

 

And press J and K keys together.

Edited by nikivi
Link to comment
Share on other sites

1 hour ago, deanishe said:

I have no desire to turn my Mac into emacs.

 

I actually tried emacs once and it was really weird and I didn't like how it forces you to use emacs for everything. Vim is a lot better. VS Code + neovim embedded even more so. But Karabiner allows you to make your own emacs, only globally. So you can apply your modifications no matter what app you are in.

 

Pressing two buttons is insanely more faster than alfred trigger + keyword or trying to memorise all the funky cmd + opt + .. hotkeys than no human can keep in their head. I tried. Instead, all you need to memorise is o + f is searching git repos or o + g is searching top processes workflow and so on. And you don't even have to memorise anything because you just use it.

 

Edited by nikivi
Link to comment
Share on other sites

39 minutes ago, nikivi said:

included the official README

 

That will be done when the workflow is released and moved to GitHub.

 

The README is also included with the workflow. And I linked it above.

Edited by deanishe
Link to comment
Share on other sites

6 minutes ago, nikivi said:

copy the URL of the tab into clipboard

 

I suppose that would be the most useful data to copy.

 

7 minutes ago, nikivi said:

really handy for me

 

Unless you're a paying client, "for me" is never a good argument for a feature request.

 

If you want someone to add a feature to their software, show how it would be useful to lots of users. Nobody cares about a single user unless it's their mum.

Link to comment
Share on other sites

1 minute ago, nikivi said:

Well I don't often know what most users want.

 

You have an imagination, don't you? You must have some sense of what would be a broadly useful feature vs one that's only of interest to you.

 

1 minute ago, nikivi said:

Didn't mean to sound disrespectful.

 

I don't think it was disrespectful in any way.

 

I'm just saying that "for me" is not a good justification for a feature request. And if you can't think of a better one, the request will likely be rejected because few developers are going to implement something just for you.

 

Link to comment
Share on other sites

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