Thank you so much for your help. I succeed to get 8 results per page. But, I note that hte results are sometimes a bit strange. For example : The Query was : " water life" . I got for example these results :
1. Wellies Stock Photo Images. 816 wellies royalty free images and ... http://www.fotosearch.com/photos-images/wellies.html 2. Welly Stock Photo Images. 821 welly royalty free images and ... http://www.fotosearch.com/photos-images/welly.html 3. Family Support Services New - WACYPC : Family Support Services New ... http://www.wacy-pc.org/family_support_services_new/ 4. Amazon.com: The Great Gardens of China: History, Concepts ... http://www.amazon.com/Great-Gardens-China-Concepts-Techniques/dp/1580933033 5. astropixie: 03/01/2011 - 04/01/2011 http://amandabauer.blogspot.com/2011_03_01_archive.html 6. Foodie's Hope: September 2006 http://www.foodieshope.org/2006_09_01_archive.html 7. Amazon.com: Ocean (9781405312929): Fabien Cousteau: Books http://www.amazon.com/Ocean-Fabien-Cousteau/dp/1405312920 8. From Ranger to Leather Neck http://kennethcarlson.blogspot.com/ These results are not the same as I find when writing for this Query using www.gooogle.com !!! And they are not so related to the query . They don't match very well with the Query. Also , I notice that sometimes after x results , I can't get more. For example , when looking for the query " family help" , I can get only 12 results. However, when looking for the query "help", I can get 37 results. Regards, Asma 2011/6/29 Jeremy Geerdes <[email protected]> > 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. > -- 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.
