You can read about all the parameters and their uses in the documentation:

http://code.google.com/apis/websearch/docs/reference.html#_intro_fonje

Jeremy R. Geerdes
Generally Cool Guy
Des Moines, IA

For more information or a project quote:
[email protected]

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

On Jun 29, 2011, at 9:24 AM, Asma Mejri wrote:

> Thank you so much for your advices. 
> I'm working with  AJAX Search API for just 3 months for my Master project. 
> That's why, it isn't a matter if this API will be discontinued.
> I didn't understand how to use the start parameter to pull additional pages 
> of results.
> 
> Regards 
> Asma
> 
> 
> 2011/6/29 Jeremy Geerdes <[email protected]>
> You need to add "&rsz=NUMBER" to your url, where NUMBER is a number from 1 - 
> 8, inclusive. Beyond that, you can also use the start parameter to pull 
> additional "pages" of results with subsequent requests.
> 
> That said, it is important to note that the AJAX Search API (all varieties) 
> has been deprecated and scheduled to be discontinued no later than May 2014. 
> The Web Search API, in particular, will be discontinued no later than 
> November 2013. You may want to utilize the Custom Search API or consider 
> other options, depending on your application needs. At the very least, be 
> aware of the pending doom of the AJAX APIs.
> 
> Jeremy R. Geerdes
> Generally Cool Guy
> Des Moines, IA
> 
> For more information or a project quote:
> [email protected]
> 
> If you're in the Des Moines, IA, area, check out Debra Heights Wesleyan 
> Church!
> 
> On Jun 29, 2011, at 8:08 AM, assma.m wrote:
> 
> > Hi,
> > I'm working in Java (Eclipse Platform).
> > I'm a new user of Google Ajax APIs.
> > I need to get results from google when giving a query.
> > But I was surprised that I got only four results. I don't know how to
> > get more results .
> > This is the code (I developed it using :
> > http://code.google.com/intl/fr/apis/websearch/docs/#The_Basics : the
> > JAVA Access Section) :
> >
> > import java.io.BufferedReader;
> > import java.io.InputStreamReader;
> > import java.net.URL;
> > import java.net.URLConnection;
> > import java.net.URLEncoder;
> >
> >
> > import net.sf.json.*;
> >
> >
> > public class GoogleQuery {
> >
> > private final String HTTP_REFERER = "http://
> > www.mygooglesearchssite.com/AsmaSite/";
> >
> > public GoogleQuery() {
> > makeQuery("life");
> > }
> >
> > private void makeQuery(String query) {
> >
> > System.out.println("\nQuerying for " + query);
> >
> > try
> > {
> > // Convert spaces to +, etc. to make a valid URL
> > query = URLEncoder.encode(query, "UTF-8");
> >
> > URL url = new URL(
> >           "https://ajax.googleapis.com/ajax/services/search/web?v=1.0&";
> >           + "q="+query
> >           +"&key=MYKEY&userip=MYUSERIP");
> >
> > URLConnection connection = url.openConnection();
> > connection.addRequestProperty("Referer", HTTP_REFERER);
> >
> > // Get the JSON response
> > String line;
> > StringBuilder builder = new StringBuilder();
> > BufferedReader reader = new BufferedReader(
> > new InputStreamReader(connection.getInputStream()));
> > while((line = reader.readLine()) != null) {
> >       System.out.println(line);
> >       builder.append(line);
> > }
> >
> > String response = builder.toString();
> > JSONObject json = new JSONObject(builder.toString());
> > JSONObject jsonObject = new JSONObject();
> >
> > System.out.println("Total results = " +
> > json.getJSONObject("responseData")
> > .getJSONObject("cursor")
> > .getString("estimatedResultCount"));
> >
> > JSONArray ja =
> > json.getJSONObject("responseData").getJSONArray("results");
> >
> > System.out.println("\nResults:");
> > for (int i = 0; i < ja.length(); i++) {
> > System.out.print((i+1) + ". ");
> > JSONObject j = ja.getJSONObject(i);
> > System.out.println(j.getString("titleNoFormatting"));
> > System.out.println(j.getString("url"));
> > }
> > }
> > catch (Exception e) {
> > System.err.println("Something went wrong...");
> > e.printStackTrace();
> > }
> > }
> >
> > public static void main(String args[]) {
> > new GoogleQuery();
> > }
> > }
> >
> > I need your help.
> > Regards,
> > Asma
> >
> > --
> > You received this message because you are subscribed to the Google Groups 
> > "Google AJAX APIs" group.
> > To post to this group, send email to 
> > [email protected].
> > To unsubscribe from this group, send email to 
> > [email protected].
> > For more options, visit this group at 
> > http://groups.google.com/group/google-ajax-search-api?hl=en.
> >
> 
> --
> You received this message because you are subscribed to the Google Groups 
> "Google AJAX APIs" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group at 
> http://groups.google.com/group/google-ajax-search-api?hl=en.
> 
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Google AJAX APIs" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group at 
> http://groups.google.com/group/google-ajax-search-api?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Google AJAX APIs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-ajax-search-api?hl=en.

Reply via email to