com.yahoo.search
Class SearchClient

java.lang.Object
  extended by com.yahoo.search.SearchClient

public class SearchClient
extends Object

The SearchClient class handles all calls to/from the Yahoo Search Web Service. Additionally, it translates the XML responses into Java objects before returning results to the caller. Each SearchClient instance has an associated application ID ("appid"). You will need to register an application ID with Yahoo prior to using SearchClient.

Author:
Ryan Kennedy

Constructor Summary
SearchClient(String appId)
          Constructs a new SearchClient with the given application ID using the default settings.
 
Method Summary
 WebSearchResults contextWebSearch(ContextSearchRequest request)
          Searches the Yahoo database for web results using a context-based query.
 ImageSearchResults imageSearch(ImageSearchRequest request)
          Searches the Yahoo database for image files.
 LocalSearchResults localSearch(LocalSearchRequest request)
          Searches the Yahoo database for local results.
 MapSearchResults mapSearch(MapSearchRequest request)
          Searches the Yahoo database for a location.
 NewsSearchResults newsSearch(NewsSearchRequest request)
          Searches the Yahoo database for news results.
 RelatedSuggestionResults relatedSuggestion(RelatedSuggestionRequest request)
          Requests search terms related to the given search term.
 SpellingSuggestionResults spellingSuggestion(SpellingSuggestionRequest request)
          Requests a possible spelling correction for the given query.
 ContentAnalysisResults termExtractionSearch(ContentAnalysisRequest request)
          Searches a bit of content for relevant, related search terms.
 VideoSearchResults videoSearch(VideoSearchRequest request)
          Searches the Yahoo database for video files.
 WebSearchResults webSearch(WebSearchRequest request)
          Searches the Yahoo database for web results.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SearchClient

public SearchClient(String appId)
Constructs a new SearchClient with the given application ID using the default settings.

Parameters:
appId - The ID of the calling application.
Method Detail

imageSearch

public ImageSearchResults imageSearch(ImageSearchRequest request)
                               throws IOException,
                                      SearchException
Searches the Yahoo database for image files.

Parameters:
request - The request to search for.
Returns:
Results of the search.
Throws:
IOException - Thrown if any network issues occur while making the call.
SearchException - Thrown if the request is invalid or if the service is malfunctioning.

localSearch

public LocalSearchResults localSearch(LocalSearchRequest request)
                               throws IOException,
                                      SearchException
Searches the Yahoo database for local results.

Parameters:
request - The request to search for.
Returns:
Results of the search.
Throws:
IOException - Thrown if any network issues occur while making the call.
SearchException - Thrown if the request is invalid or if the service is malfunctioning.

newsSearch

public NewsSearchResults newsSearch(NewsSearchRequest request)
                             throws IOException,
                                    SearchException
Searches the Yahoo database for news results.

Parameters:
request - The request to search for.
Returns:
Results of the search.
Throws:
IOException - Thrown if any network issues occur while making the call.
SearchException - Thrown if the request is invalid or if the service is malfunctioning.

videoSearch

public VideoSearchResults videoSearch(VideoSearchRequest request)
                               throws IOException,
                                      SearchException
Searches the Yahoo database for video files.

Parameters:
request - The request to search for.
Returns:
Results of the search.
Throws:
IOException - Thrown if any network issues occur while making the call.
SearchException - Thrown if the request is invalid or if the service is malfunctioning.

mapSearch

public MapSearchResults mapSearch(MapSearchRequest request)
                           throws IOException,
                                  SearchException
Searches the Yahoo database for a location.

Parameters:
request - The request to search for.
Returns:
Results of the search.
Throws:
IOException - Thrown if any network issues occur while making the call.
SearchException - Thrown if the request is invalid or if the service is malfunctioning.

webSearch

public WebSearchResults webSearch(WebSearchRequest request)
                           throws IOException,
                                  SearchException
Searches the Yahoo database for web results.

Parameters:
request - The request to search for.
Returns:
Results of the search.
Throws:
IOException - Thrown if any network issues occur while making the call.
SearchException - Thrown if the request is invalid or if the service is malfunctioning.

spellingSuggestion

public SpellingSuggestionResults spellingSuggestion(SpellingSuggestionRequest request)
                                             throws IOException,
                                                    SearchException
Requests a possible spelling correction for the given query.

Parameters:
request - The search query to request a suggestion for.
Returns:
Result of the search.
Throws:
IOException - Thrown if any network issues occur while making the call.
SearchException - Thrown if the request is invalid or if the service is malfunctioning.

relatedSuggestion

public RelatedSuggestionResults relatedSuggestion(RelatedSuggestionRequest request)
                                           throws IOException,
                                                  SearchException
Requests search terms related to the given search term.

Parameters:
request - The search term to request suggestions for.
Returns:
Results of the search.
Throws:
IOException - Thrown if any network issues occur while making the call.
SearchException - Thrown if the request is invalid or if the service is malfunctioning.

contextWebSearch

public WebSearchResults contextWebSearch(ContextSearchRequest request)
                                  throws IOException,
                                         SearchException
Searches the Yahoo database for web results using a context-based query.

Parameters:
request - The request to search for.
Returns:
Results of the search.
Throws:
IOException - Thrown if any network issues occur while making the call.
SearchException - Thrown if the request is invalid or if the service is malfunctioning.

termExtractionSearch

public ContentAnalysisResults termExtractionSearch(ContentAnalysisRequest request)
                                            throws IOException,
                                                   SearchException
Searches a bit of content for relevant, related search terms.

Parameters:
request - The request to extract terms from.
Returns:
Results of the term extraction.
Throws:
IOException - Thrown if any network issues occur while making the call.
SearchException - Thrown if the request is invalid or if the service is malfunctioning.