Abzetdin Adamov's IT Blog

IT is about doing more with less!

Archive for March 13th, 2011

Fully Customized Search Engine by Google Search Ajax API

Posted by Abzetdin Adamov on March 13, 2011

The information is most valuable wealth of humanity today. According to IDC Report we all are getting to be richer rapidly in this meaning. So that, according to this report (The Digital Universe Decade – Are You Rady? ) the amount of digital data worldwide (Digital Universe) will grow this year to 1.2 million petabytes or 1.2 zettabytes. Annual growth makes up more than 60%. By 2020 our Digital Universe will be 44 times as big as it was in 2009.
So, the ability to find appropriate piece of information within this tremendous amount structured and unstructured data getting to be more and more important. It’s why we all love Google so much! But Google is not self-centred (selfish), but rather Google makes his own technology opened for others to develop customized Search Engines, in particular (to be рonest this opennes is restricted, unfortunately).

I’m going to share with you my Fully Customized Search Engine developed by using Google Search Ajax API. If you have an idea how to improve it or you may want to share your mind, feel free to drop a comment.

HTML Code of Customized Search String Input within Container. Don’t forget to get your own Google Ajax API Key at http://code.google.com/apis/loader/signup.html
Download all in one: GSearchEngine.zip

Primary JavaScript Code based on Google Search Ajax API

// Abzetdin Adamov
// Fully Customized Search Engine by Google Search Ajax API
// JavaScript Code based on Google AJAX API
// Last modified 03/13/2011

var searchControl;
window.onload = onLoad;

function onLoad() {
searchControl = new GSearchControl();

searchOptions = new google.search.SearcherOptions();

var webSrearch = new GwebSearch();
searchControl.addSearcher(webSrearch, searchOptions);

var siteSearch = new GwebSearch();

var blogsSrearch = new GblogSearch();

var imgSrearch = new GimageSearch();

var drawOptions = new GdrawOptions();
searchControl.draw(document.getElementById("searchcontrol"), drawOptions);

var query = null;
document.onkeydown = function(event) { kd(event); };

document.getElementById('queryInput').onfocus = function(event) { inputFocus(event); };
document.getElementById('queryInput').onblur = function(event) { inputBlur(event); };

var searched = false;
function kd(e) {
if (!e) e = event;
if (query == null)
query = document.getElementById('queryInput');
if (e.keyCode == 27) {
query.value = '';

function inputFocus() {
var queryInput = document.getElementById('queryInput');
queryInput.style.color = "#555";
if (queryInput.value && queryInput.value == "Введите строку для поиска в Adamov.net.ru") {
queryInput.value = "";

function inputBlur() {
var queryInput = document.getElementById('queryInput');
queryInput.style.color = "#bbb";
if (!queryInput.value) {
queryInput.value = "Введите строку для поиска в Adamov.net.ru";

Fully Customized Search Engine: DEMO
Download all in one: GSearchEngine.zip

Posted in Programming and Development, Web Programming and Design | Tagged: , , | Leave a Comment »