Increase site efficiency by retrieving just your preferred number of results
June 29th, 2010 | Published in Google Ajax API
When using any of the searchers available in the Search API, four results are returned by default. Historically, it has been possible to request a large set of eight results (or ten for filter Custom Search Engines), but that’s it. We understand that there are many use cases for this API, and some of them require a finer grain of control over the number of results displayed.
For instance, with the JavaScript API, you can use
With this addition, you can now request an arbitrary number of results, based on the exact number you need. By requesting only the results you’re going to show to the end-user, you can make your site or app more efficient. Also, this will control the cursor values that can be used to retrieve subsequent pages of results (and impact paging in the Custom Search element).
For more details, check out the documentation, and if you have any questions, stop by our IRC channel and support forum.
For instance, with the JavaScript API, you can use
.setResultSetSize(1)
or .setResultSetSize(6)
in addition to using the enum to request a SMALL_RESULTSET
or LARGE_RESULTSET
. When using the RESTful interface, you can also use any integer from 1 to 8 with the rsz
parameter.With this addition, you can now request an arbitrary number of results, based on the exact number you need. By requesting only the results you’re going to show to the end-user, you can make your site or app more efficient. Also, this will control the cursor values that can be used to retrieve subsequent pages of results (and impact paging in the Custom Search element).
For more details, check out the documentation, and if you have any questions, stop by our IRC channel and support forum.