How to Google Instant(ise) a Custom Search Engine (CSE)

[flickr]4605291728[/flickr]

Update: This solution has evolved slightly. More information in How to Google Instant(ise) a Custom Search Engine (CSE) – Revisited

Google have grabbed quite a few headlines with their new Instant search and there has been a rush of developers ‘instantising’ other sites. The one which has got the most attention is Stanford student Feross Aboukhadijeh who after making YouTube Instant has been offered a job with YouTube.

Following this and some other ‘Instant’ sites popping up (usually with an employ me banner) Tam Denholm has come up with instantise.com which at last count has 16 different sites that you can get an instant style search result. A number of these are created by just adding a ‘site:a-single-site.com’ operator which limits the search just to a particular domain.

But what is you want to search across multiple domains like the ALTC2010 custom search engine created by Tony Hirst from the #altc2010 hashtag community (See Deriving a Persistent EdTech Context from the ALTC2010 Twitter Backchannel)?

Fortunately the Google AJAX Search API used in Tam’s example can be directed filtered using a Google Custom Search Engine. Here’s how to do it (BTW :

  1. Log in to Custom Search and set up your own custom search engine
  2. Next you need to sign up for an API key on the Google AJAX Search API
  3. Download this code unpacking the files
  4. In instant.js you will need to enter you AJAX API key and your Google Custom Search ID (this information is on the Basic’s page of the CSE control panel)
  5. Upload files to your server and test them

I only modified Tam’s files slightly but one addition I made was to include the Google Scribe bookmarklet script. Google Scribe is a Google Labs project which provides autotext completion. Whilst this is probably not as accurate as the prediction used in Google Instant (Scribe helps build sentences rather than return the most popular search terms) it still potentially speeds up the process of getting search results (here is more info on Google Instant, behind the scenes).
If you want to see how all of this looks:

*** Here is a Google Instant(ish) search of this blog and some of my other social media activity ***

BTW if anyone wants to give me a job you should also check out my post on Convergence @youtube meets @twitter: In timeline commenting of YouTube videos using Twitter [uTitle] 😉

chevron_left
chevron_right

Join the conversation

comment 7 comments
  • John McLear

    We considered using instant.js on safe search but decided against it as autocomplete can output some undesirable results for little ones!

    • Martin Hawksey

      Hi John – I’m using Google Scribe to cheat an autocomplete. I’m not sure if it is safe but it can be deactivated by commenting out line 11 of instant.js. This will mean the search will still be automatically updated as the user types (without autocomplete). There might be some settings when you setup the CSE to enabe safe search, you can also enable this in line 37 of instant.js by adding &safe=active to the querysting (more documentation here)
      Martin

  • Ivan

    I just did those steps and it is working really really web!
    Just one question:
    How do i force to show more results? So far it just shows 4 in a single page (and no pagination obiusly)

    • Martin Hawksey

      Hi Ivan,
      I’ve updated this solution which has better page layout and added functionality here. I haven’t released the code but it is easy to scrape from the view source. (The limiting might just be related to the search you are trying. e.g. in this search page if you enter ‘starred’ it shows 9 results.
      Martin
      Martin

  • sasha

    hi
    how can show results in multi pages?

Comments are closed.

css.php