In Chrome, is there a way to search only within my bookmarked sites?

I'm not trying to search for a bookmark - I'm trying to search for a term that may appear on one of my bookmarked sites.

For instance, if I wanted to search on the term "Obama" and restrict my query to the New York Times web site, I know I could type this into the main URL/Search bar in Chrome:

obama site:nytimes.com

I'm wondering if there's a way to change that so that it's effectively:

obama site:any one of the sites in my Chrome bookmark folder

Thanks in advance for your help!


Solution 1:

I just released a Google Chrome extension called SearchMark that will do exactly what you want. Hope you find it useful.

Solution 2:

You may use the browser-based Historio.us.

This is what makeuseof.com says in Historious Takes Bookmarks To The Next Level:

The idea behind Historious is simple. Instead of storing bookmarks in folders, they’re all individually indexed; just like Google does with the whole of the internet, to create your personalized search world. This search engine, which can be used in every browser, across computers, allows you to search both by title and content of the indexed pages.

Historious works across browsers by bookmarklet. A bookmarklet is a (regular) bookmark that executes a bit of Javascript code. You’ll be able to add it to your bookmarks bar after you’ve completed (free) registration. Alternatively, there’s also a Google Chrome extension. This works exactly the same as the bookmarklet, and nothing keeps you from using the extension on one computer and the bookmarklet on another.

image

Solution 3:

It seems Google has a custom search you can point to your bookmarks file. From their doc, "Here's a quick and easy way to create a search engine from the links on your web page": http://www.google.com/cse/tools/create_onthefly

The way I use it, I have to export my bookmarks from xbel to an .html file, but that's a useful thing to have anyway. (Especially since I haven't found a Chrome equivalent to Galeon's "My Portal").

Solution 4:

Ctrl+Shift+O opens the Bookmark Manager page There's a Search bar/box in the top left corner that allows your to search through your bookmarks

Solution 5:

If you don't find/write a Chrome extension to do this, you could

A) get a list of your bookmark URLs

I initially thought that the Bookmarks file in the chrome profile directory was an sqlite3 DB like some of the other files in there. This is incorrect. It looks like a JSON file, so what you'll probably want to do is to import it into some scripting language that has JSON facilities (pretty much anything beginning with 'p' is a safe bet, or even JS if you want to use rhino/spidermonkey/etc) and then extract certain elements.

At first glance, it looks like you'll want the url property of each object that has a 'type' property equal to "url". There are some complications though: for example, this will also include bookmarklets and other things that don't have [relevant] sites, so you'll probably want to run a filter on the results to restrict them to actual web URLs. Whatever you use in B to get the sites might test for this first anyway and return an error on invalid URLs.

B) reduce the list of bookmark URLs (A) to the list of hosts they use

I think this is what you want? Or maybe domains? Except if it's like *.co.uk or similar? This is probably most sensibly done in the same script that you use in A. Another option is to pipe it through a sed | sort | uniq filter, though with that option you don't end up actually parsing the URL, and you have to bust out some ghetto regex for it. php is really good at this sort of thing. Well, compared to its appropriateness for most tasks.

C) build a google query URL

...by prefixing each item from B with site:, joining them with the string +OR+, and then url-encoding and appending (after a +) the specific text you want to do a search on. You stick the result on the end of a string like http://www.google.com/search?q=.

This should give you a URL like http://www.google.com/search?q=site:superuser.com+OR+site:stackoverflow.com+chrome

Then you should be able to just pass that URL as the first argument to a command-line invocation of google-chrome to get it to open a new tab containing the search results. Note that, least under bash, you'll need to wrap the URL in quotes so that it doesn't get shell expansion applied to it.

So if you want to, you can roll this into a command line utility, and then just run it by passing your search terms to it. If Chrome is running, you should probably make a copy of the Bookmarks file before reading it in, and then delete the temp file afterwards.

If you already know JS, and especially if you don't know command-line-friendly scripting languages, it might be easier to learn how how to write a Chrome extension than to rig this up.