How to set rsz to large.

324 views
Skip to first unread message

Ckrome1

unread,
Jul 3, 2009, 2:21:16 PM7/3/09
to Google AJAX APIs
I finally found the solution to my problem, which was that my
LocalSearch only returns 4 results. Apparently it is because the
default rsz is set to small, and I need to set it to large for it to
return 8 results. The problem is, I can't find a tutorial ANYWHERE on
how to set rsz to large. I've tried every way I can think of and I
cant manage. Please help me out here.
If i was using a searchControl it would be fine, I would just use
LARGE_RESULTSET but i'm not. I'm using a LocalSearch to get raw data
and add it to a google maps instance without a searchControl.

Jeremy Geerdes

unread,
Jul 3, 2009, 3:18:52 PM7/3/09
to Google-AJAX...@googlegroups.com
If you're using the Javascript API's RAW searchers, call this:

searcher.setResultSetSize(google.search.Search.LARGE_RESULTSET);

If you're using the RESTful side of the API (i.e., via JSONP or some
non-Javascript environment), you just add &rsz=large to the url you're
requesting for results.

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
!

imran mughal

unread,
Jul 3, 2009, 3:32:06 PM7/3/09
to Google-AJAX...@googlegroups.com
Hey i want to increase number of results now it is 8 can i increase in google ajax customized search

--
Regards....
Imran

Jeremy Geerdes

unread,
Jul 3, 2009, 3:36:11 PM7/3/09
to Google-AJAX...@googlegroups.com
8 is the most you can get in one request to the AJAX Search API.
However, I have posted on my blog how you can sequentially obtain as
many results as are available.

http://jgeerdes.blogspot.com/2008/12/how-to-get-all-results-available-from.html

Make sure to check the comments; there's a bug fix in there. And yes,
the same concepts and logic applies if you're using a non-Javascript
environment as well. You just have to add in the parsing, etc.

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
!


Ckrome1

unread,
Jul 3, 2009, 4:40:08 PM7/3/09
to Google AJAX APIs
Thanks! That's exactly what I needed, all fixed now.
Thank you for your time.

imran mughal

unread,
Jul 3, 2009, 5:10:10 PM7/3/09
to Google-AJAX...@googlegroups.com
thanx allot for guiding 
I used that but unable to see all results @once 

Please see my code if you have time and further guide me really thanx of you

google.load('search', '1');

function OnLoad() {

  // create a tabbed mode search control
  var tabbed = new google.search.SearchControl();
tabbed.setResultSetSize(google.search.Search.LARGE_RESULTSET);
tabbed.setSearchCompleteCallback(tabbed,function(){

// Set a handle to the cursor object that we're going to use repeatedly
var cursor = this.cursor;

// Create a new property on the searcher that we can stash results into so they don't disappear when we go to the next page.
if(!this.allResults || cursor.currentPageIndex==0){this.allResults = [];}

// Add the new results to the other results
this.allResults = this.allResults.concat(this.results);

// Check to see if the searcher actually has a cursor object and, if so, if we're on the last page of results. If not...
if (cursor && cursor.pages.length>cursor.currentPageIndex+1){

// Go to the next page.
this.gotoPage(cursor.currentPageIndex+1);

// Else, if there is no cursor object or we're on the last page...
} else {

// Loop through the results and...
for(var i=0; i<this.allResults.length; i++){
var result = this.allResults[i];


// Plug them into the document where we want them.
document.body.appendChild(result.html.cloneNode(1));
}
}
});
  // create our searchers.  There will now be 3 tabs.
//  tabbed.addSearcher(new google.search.LocalSearch());
  tabbed.addSearcher(new google.search.WebSearch());
//  tabbed.addSearcher(new google.search.BlogSearch());
tabbed.addSearcher(new google.search.VideoSearch());
tabbed.addSearcher(new google.search.ImageSearch());
tabbed.addSearcher(new google.search.PatentSearch());
//      searchControl.addSearcher(localSearch);
//      tabbed.addSearcher(new google.search.WebSearch());
//      searchControl.addSearcher(new google.search.BlogSearch());
//
// searchControl.addSearcher(new google.search.LocalSearch());
// searchControl.addSearcher(new google.search.WebSearch());
// searchControl.addSearcher(new google.search.VideoSearch());
// searchControl.addSearcher(new google.search.BlogSearch());
// searchControl.addSearcher(new google.search.NewsSearch());
// searchControl.addSearcher(new google.search.ImageSearch());
// searchControl.addSearcher(new google.search.BookSearch());
// searchControl.addSearcher(new google.search.PatentSearch());

  // draw in tabbed layout mode
 // setOnKeepCallback(object, method, opt_keepLabel?);
  var drawOptions = new google.search.DrawOptions();
  drawOptions.setDrawMode(google.search.SearchControl.DRAW_MODE_TABBED);

  // Draw the tabbed view in the content div
  tabbed.draw(document.getElementById("content"), drawOptions);

  // Search!
  tabbed.execute("Subaru STI");
// tabbed.execute(aa);
}
//.setInput('inp');
google.setOnLoadCallback(OnLoad);
//google.draw(element, opt_drawOptions?)
</script>
</head>
  <body>
    <div id="content" style="width:1000px">Loading...</div><br />


--
Regards....
Imran
Reply all
Reply to author
Forward
0 new messages