regarding showing the results

8 views
Skip to first unread message

Vikram Kumar

unread,
May 4, 2009, 1:16:02 AM5/4/09
to Google-AJAX...@googlegroups.com
hi, i want to show the 8 results at one time but when i start it is showing only one ...it is having the default value 1 thats why it showing only result ...i want the 8 results in my webpage as a default results....can anyone help me..

thanks and regards,
vikram

--
विक्रम कुमार........!!!!!!!!!

Jeremy Geerdes

unread,
May 4, 2009, 6:42:51 AM5/4/09
to Google-AJAX...@googlegroups.com
To show all 8 results, you need to do two things to your default
search control:

1. call
searchControl.setResultSetSize(google.search.Search.LARGE_RESULTSET);
at some point after it is initialized but before it is executed.

2. Create a SearcherOptions object, set its expansion mode to open,
and pass that to the searchControl's addSearcher method.

For example:

function init(){
var searchControl=new google.search.SearchControl;
searchControl.setResultSetSize(google.search.Search.LARGE_RESULTSET);
var searcherOptions=new google.search.SearcherOptions();

searcherOptions
.setExpandMode(google.search.SearchControl.EXPAND_MODE_OPEN);
var ws=new google.search.WebSearch;
searchControl.addSearcher(ws, searcherOptions);

searchControl.execute('bmw');
}

Jeremy R. Geerdes
Effective website design & development
Des Moines, IA

For more information or a project quote:
http://jgeerdes.home.mchsi.com
http://jgeerdes.blogspot.com
http://jgeerdes.wordpress.com
jgee...@mchsi.com

Unless otherwise noted, any price quotes contained within this
communication are given in US dollars.

If you're in the Des Moines, IA, area, check out Debra Heights
Wesleyan Church!

And check out my blog, Adventures in Web Development, at http://jgeerdes.blogspot.com
!

Vikram Kumar

unread,
May 4, 2009, 6:59:51 AM5/4/09
to Google-AJAX...@googlegroups.com
Hi,
        thanks but I am using GSearchControl and I use this statement

searchControl.setResultSetSize(GSearch.LARGE_RESULTSET);

but it wont work.
here is the code:

        function OnLoad()
       {
// create a search control
         var searchControl = new GSearchControl();

searchControl.setResultSetSize(GSearch.LARGE_RESULTSET);

         // add in a full set of searchers
       searchControl.addSearcher(new GwebSearch());

       // Set a callback so that whenever a search is started we will call searchStart
       searchControl.setSearchStartingCallback(this, searchStart);

         // establish a keep callback
         searchControl.setOnKeepCallback(this, MyKeepHandler);

         searchControl.setSearchStartingCallback(this, searchComplete);

   // tell the searcher to draw itself and tell it where to attach
       searchControl.draw(document.getElementById("search_control"));

// execute an inital search
         searchControl.execute("google ajax search api");

        }

thanks and regards
vikram

Jeremy Geerdes

unread,
May 4, 2009, 8:16:57 AM5/4/09
to Google-AJAX...@googlegroups.com
The solution is the same; the namespace is slightly different.  Rather than using google.search.SearcherOptions, use GsearcherOptions.  So change your line reading searchControl.addSearcher(new GwebSearch()); to this:

var searcherOptions = new GsearcherOptions;
searcherOptions.setExpandMode(GSearchControl.EXPAND_MODE_OPEN);
searchControl.addSearcher(new GwebSearch, searcherOptions);

Jeremy R. Geerdes
Effective website design & development
Des Moines, IA

For more information or a project quote:

Unless otherwise noted, any price quotes contained within this communication are given in US dollars.

If you're in the Des Moines, IA, area, check out Debra Heights Wesleyan Church!

And check out my blog, Adventures in Web Development, at http://jgeerdes.blogspot.com !


Vikram Kumar

unread,
May 5, 2009, 2:02:03 AM5/5/09
to Google-AJAX...@googlegroups.com
it works, thanks man......
Reply all
Reply to author
Forward
0 new messages