I am using Google Search API in a website to produce results from the website.(the site) the problem is, it is not producing results at all. If I change the site restriction to some other site(e.g. wikipedia.org or any other) it produces results.
It is not that the site is not listed - when I search for site:www.hinroengineering.com
on the Google home page I get results.
Code is as follows:
google.load('search', '1');
function OnLoad() {
// Create a search control
var searchControl = new google.search.SearchControl();
// web search, open
options = new google.search.SearcherOptions();
options.setExpandMode(google.search.SearchControl.EXPAND_MODE_OPEN);
// Add in a WebSearch
var webSearch = new google.search.WebSearch();
// Restrict our search to pages from the current site only
webSearch.setSiteRestriction('http://www.hinroengineering.com');
webSearch.setUserDefinedLabel(" Search results ");
// Add the searcher to the SearchControl
searchControl.addSearcher(webSearch, options);
// tell the searcher to draw itself and tell it where to attach
searchControl.draw(document.getElementById("SeachContent"));
searchControl.setResultSetSize(google.search.Search.LARGE_RESULTSET);
// execute an inital search
searchControl.execute(CurrentSearchTerm);
//alert(webSearch.results.length);
}
google.setOnLoadCallback(OnLoad);