|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Object | +--com.google.soap.search.GoogleSearch
The GoogleSearch class encapsulates access to the Google Web APIs. It provides access to search and cached page functions via SOAP. Examples of use:
GoogleSearch search = new GoogleSearch();
// Set mandatory attributes
search.setKey("000000000000000000000000");
search.setQueryString("Internet standards");
// Set optional attributes
search.setSafeSearch(true);
// Invoke the actual search
GoogleSearchResult result = search.doSearch();
// process the result
GoogleSearch cache = new GoogleSearch();
cache.setKey("00000000000000000000");
String page = cache.doGetCachedPage("http://www.google.com/");
GoogleSearchFault,
GoogleSearchResult,
GoogleSearchResultElement,
GoogleSearchDirectoryCategory| Constructor Summary | |
GoogleSearch()
Construct a new instance of a GoogleSearch client. |
|
| Method Summary | |
byte[] |
doGetCachedPage(java.lang.String url)
Retrieve a cached web page from Google. |
GoogleSearchResult |
doSearch()
Invoke the Google search. |
java.lang.String |
doSpellingSuggestion(java.lang.String phrase)
Ask Google to return a spelling suggestion for a word or phrase. |
void |
setFilter(boolean on)
Enable or disable the "related-queries" filter. |
void |
setInputEncoding(java.lang.String ie)
Set the input encoding. |
void |
setKey(java.lang.String key)
Set the user key used for authorization by Google SOAP server. |
void |
setLanguageRestricts(java.lang.String lr)
Set the language restricts for the search. |
void |
setMaxResults(int maxResults)
Set the maximum number of results to be returned. |
void |
setOutputEncoding(java.lang.String oe)
Set the output encoding. |
void |
setQueryString(java.lang.String q)
Set the query string for this search. |
void |
setRestrict(java.lang.String restrict)
Set the restrict. |
void |
setSafeSearch(boolean safeSearch)
Enable or disable SafeSearch. |
void |
setSoapServiceURL(java.lang.String soapServiceURL)
Set the URL of the Google SOAP Search service. |
void |
setStartResult(int start)
Set the index of the first result to be returned. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public GoogleSearch()
| Method Detail |
public void setKey(java.lang.String key)
public void setSoapServiceURL(java.lang.String soapServiceURL)
public void setQueryString(java.lang.String q)
public void setStartResult(int start)
public void setMaxResults(int maxResults)
public void setFilter(boolean on)
public void setRestrict(java.lang.String restrict)
public void setSafeSearch(boolean safeSearch)
public void setLanguageRestricts(java.lang.String lr)
lr - List of languages separated by | vertical bar characters.
Example value (German and French): lang_de|lang_frpublic void setInputEncoding(java.lang.String ie)
ie - new input encoding value.
Default value: latin1
Example value: shift-jispublic void setOutputEncoding(java.lang.String oe)
oe - new output encoding value.
Default value: latin1
Example value: latin9
public GoogleSearchResult doSearch()
throws GoogleSearchFault
GoogleSearchFault - If a) mandatory attributes were not set,
b) anything goes wrong on the server side, or
c) anything goes wrong with the connection.GoogleSearchFault,
GoogleSearchResult,
GoogleSearchResultElement,
GoogleSearchDirectoryCategory
public byte[] doGetCachedPage(java.lang.String url)
throws GoogleSearchFault
url - The url of the page to retrieve the cached version of.GoogleSearchFault - If a) mandatory attributes were not set,
b) anything goes wrong on the server side, or
c) anything goes wrong with the connection.GoogleSearchFault
public java.lang.String doSpellingSuggestion(java.lang.String phrase)
throws GoogleSearchFault
key - Identifies the user for query limiting and authorization.phrase - The word or phrase to correct the spelling forGoogleSearchFault - If a) key is invalid, or daily query limit for the key was reached.
b) anything goes wrong on the server side.
c) anything goes wrong with the connection.
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||