| Package | com.yahoo.webapis.search |
| Class | public class SearchService |
| Inheritance | SearchService ServiceBase flash.events.EventDispatcher |
| Implements | IService |
Yahoo! Search Web Services allow you to access Yahoo! content and services.
MXML Syntax
Hide MXML Syntax
The <yahoo:SearchService> has the following tag attributes:
<yahoo:SearchService
Properties
applicationId="YahooDemo"
type="web|image|audio|video|local|artist|album|song|songDownload|news|context|termExtraction|related|spellingSuggestion"
query="No default"
startAt="0"
maximumResults="10"
request="No default"
Events
result="No default"
fault="No default"
/>
To use this class in MXML, do the following:
<yahoo:SearchService applicationId="YahooDemo" type="web"/>
Then give the tag a query attribute with your search terms and call the send() method.
For more advanced usage, declare a SearchParams object, give it properties applicable to the type of search
you are performing, and pass this to the send() method
<?xml version="1.0" encoding="utf-8"?>
<mx:Application
xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:yahoo="http://www.yahoo.com" >
<!-- The formatter to format the total results with commas -->
<mx:NumberFormatter id="commaFormatter"/>
<!-- The Service for all types of searches -->
<yahoo:SearchService id="searchService" applicationId="YahooDemo" query="{criteriaTextInput.text}" type="web" maximumResults="50"/>
<!-- The form for searching -->
<mx:HBox defaultButton="{searchButton}">
<mx:TextInput id="criteriaTextInput"/>
<mx:Button id="searchButton" label="search" click="searchService.send()"/>
</mx:HBox>
<mx:Label text="{commaFormatter.format(searchService.numResultsAvailable)} results" visible="{Boolean(searchService.numResultsAvailable)}"/>
<!-- The results as a List -->
<mx:List id="resultsList" showDataTips="true" dataProvider="{searchService.lastResult}" variableRowHeight="true" width="100%" height="100%">
<mx:itemRenderer>
<mx:Component>
<mx:VBox toolTip="{data.summary}" doubleClickEnabled="true" doubleClick="navigateToURL(new URLRequest(data.clickURL), '_blank')">
<mx:HBox >
<mx:Label text="{data.index + 1}" width="25"/>
<mx:Text text="{data.name}" fontWeight="bold"/>
</mx:HBox>
<mx:Image source="{data.thumbnail.url}" />
</mx:VBox>
</mx:Component>
</mx:itemRenderer>
</mx:List>
</mx:Application>
See also
| Property | Defined by | ||
|---|---|---|---|
![]() | applicationId : String
An Application ID is a string that uniquely identifies your application.
| ServiceBase | |
| autoIncrement : Boolean
Whether to retrieve more results on the same search.
| SearchService | ||
| firstResultPosition : uint
The position of the first result .
| SearchService | ||
| hasResultsPending : Boolean = true
If the search has more results pending
| SearchService | ||
| increment : uint = 0
The number of times this search has been performed; the "page" of results
| SearchService | ||
| lastResult : Object
The result of the last service invocation
| SearchService | ||
| lastResultPosition : uint
The position of the last result .
| SearchService | ||
| maximumResults : uint
The maximum number of results to return
| SearchService | ||
| numResultsAvailable : uint
The total amount of results available
| SearchService | ||
| numResultsReturned : uint
The amount of results of this page.
| SearchService | ||
| numTotalResultsReturned : uint
The total amount of results returned.
| SearchService | ||
| query : String
The query string to search for, in lieu of a request object
| SearchService | ||
| request : SearchParams
The request object
| SearchService | ||
| startAt : uint = 0
The result index to begin returning results at EXAMPLE: 50 would start returning results at 50
| SearchService | ||
| type : String = "web"
The type of search to perform
| SearchService | ||
| Method | Defined by | ||
|---|---|---|---|
|
Constructor.
| SearchService | ||
|
searchAlbums(params:SearchParams = null):void
Search albums based on an album, album ID, artist, or artist ID.
| SearchService | ||
|
searchArtists(params:SearchParams = null):void
Search artists based on an artist or artist ID.
| SearchService | ||
|
searchAudio(params:SearchParams = null):void
Search audio based on a query.
| SearchService | ||
|
searchContextAnalysis(params:SearchParams = null):void
Search pages based on a query and context.
| SearchService | ||
|
searchImages(params:SearchParams = null):void
Search images based on a query.
| SearchService | ||
|
searchLocal(params:SearchParams = null):void
Search local based on a query and location.
| SearchService | ||
|
searchNews(params:SearchParams = null):void
Search news based on a query.
| SearchService | ||
|
searchPodcasts(params:SearchParams = null):void
Search podcasts based on a query.
| SearchService | ||
|
searchRelatedSuggestions(params:SearchParams = null):void
Search related suggestions based on a query.
| SearchService | ||
|
searchSongDownloads(params:SearchParams = null):void
Search for places to download songs based on a song ID
| SearchService | ||
|
searchSongs(params:SearchParams = null):void
Search songs based on an song, song ID, album, album ID, artist, or artist ID.
| SearchService | ||
|
searchSpellingSuggestions(params:SearchParams = null):void
Search spelling suggestions based on a misspelled word.
| SearchService | ||
|
searchTermExtraction(params:SearchParams = null):void
Search keywords based on context.
| SearchService | ||
|
searchVideos(params:SearchParams = null):void
Search video based on a query.
| SearchService | ||
|
searchWeb(params:SearchParams = null):void
Search pages based on a query.
| SearchService | ||
|
send(parameters:Object = null):void
Search based on type.
| SearchService | ||
| Event | Summary | Defined by | ||
|---|---|---|---|---|
| Dispatched after a fault occurs. | SearchService | |||
| Dispatched after a search is finished. | SearchService | |||
| Constant | Defined by | ||
|---|---|---|---|
| ALBUM_SEARCH : String = "album" [static]
The Album Search service allows you to find information on music albums.
| SearchService | ||
| ARTIST_SEARCH : String = "artist" [static]
The Artist Search service allows you to find information on a particular musical performer.
| SearchService | ||
| AUDIO_SEARCH : String = "audio" [static]
Yahoo! Audio Search Web Services provide access to music data and audio files using structured and unstructured queries.
| SearchService | ||
| CONTEXT_ANALYSIS : String = "context" [static]
The Contextual Web Search service allows you to search the Internet for web pages using a context-based query.
| SearchService | ||
| IMAGE_SEARCH : String = "image" [static]
The Image Search Web Service allows you to search the Internet for images.
| SearchService | ||
| LOCAL_SEARCH : String = "local" [static]
Yahoo! Local Search APIs offer you a way to connect with the wealth of data in Yahoo! Local — including ratings and comments made by Yahoo! users.
| SearchService | ||
| NEWS_SEARCH : String = "news" [static]
The News Search service allows you to search the Internet for news stories.
| SearchService | ||
| PODCAST_SEARCH : String = "podcast" [static]
The Podcast Search service allows you to search the Internet for audio podcasts.
| SearchService | ||
| RELATED_SUGGESTION : String = "related" [static]
The Related Suggestion service returns suggested queries to extend the power of a submitted query, providing variations on a theme to help you dig deeper.
| SearchService | ||
| SONG_DOWNLOAD_LOCATION_SEARCH : String = "songDownload" [static]
The Song Download Location service allows you to find places to download individual songs, from the web, and from various online music sources.
| SearchService | ||
| SONG_SEARCH : String = "song" [static]
The Song Search service allows you to find information on individual songs.
| SearchService | ||
| SPELLING_SUGGESTION : String = "spellingSuggestion" [static]
The Spelling Suggestion service provides a suggested spelling correction for a given term.
| SearchService | ||
| TERM_EXTRACTION : String = "termExtraction" [static]
The Term Extraction Web Service provides a list of significant words or phrases extracted from a larger content.
| SearchService | ||
| VIDEO_SEARCH : String = "video" [static]
The Video Search service allows you to search the Internet for video clips.
| SearchService | ||
| WEB_SEARCH : String = "web" [static]
Yahoo! Web Search Web Services let you tap into the power of Yahoo! Search technologies
from within other sites, applications, and environments.
| SearchService | ||
| autoIncrement | property |
autoIncrement:Boolean [read-write]Whether to retrieve more results on the same search.
This property can be used as the source for data binding.
Implementation public function get autoIncrement():Boolean
public function set autoIncrement(value:Boolean):void
| firstResultPosition | property |
firstResultPosition:uint [read-write]The position of the first result .
This property can be used as the source for data binding.
Implementation public function get firstResultPosition():uint
public function set firstResultPosition(value:uint):void
| hasResultsPending | property |
public var hasResultsPending:Boolean = trueIf the search has more results pending
This property can be used as the source for data binding.
| increment | property |
public var increment:uint = 0The number of times this search has been performed; the "page" of results
The default value is 0.
This property can be used as the source for data binding.
| lastResult | property |
lastResult:Object [read-write]The result of the last service invocation
This property can be used as the source for data binding.
Implementation public function get lastResult():Object
public function set lastResult(value:Object):void
| lastResultPosition | property |
lastResultPosition:uint [read-write]The position of the last result .
This property can be used as the source for data binding.
Implementation public function get lastResultPosition():uint
public function set lastResultPosition(value:uint):void
| maximumResults | property |
maximumResults:uint [read-write]The maximum number of results to return
The default value is 10 maximum value is 100.
This property can be used as the source for data binding.
Implementation public function get maximumResults():uint
public function set maximumResults(value:uint):void
| numResultsAvailable | property |
numResultsAvailable:uint [read-write]The total amount of results available
This property can be used as the source for data binding.
Implementation public function get numResultsAvailable():uint
public function set numResultsAvailable(value:uint):void
| numResultsReturned | property |
numResultsReturned:uint [read-write]The amount of results of this page.
This property can be used as the source for data binding.
Implementation public function get numResultsReturned():uint
public function set numResultsReturned(value:uint):void
| numTotalResultsReturned | property |
numTotalResultsReturned:uint [read-write]The total amount of results returned.
This property can be used as the source for data binding.
Implementation public function get numTotalResultsReturned():uint
public function set numTotalResultsReturned(value:uint):void
| query | property |
public var query:StringThe query string to search for, in lieu of a request object
See also
| request | property |
| startAt | property |
public var startAt:uint = 0The result index to begin returning results at EXAMPLE: 50 would start returning results at 50
The default value is 0.
| type | property |
public var type:String = "web"The type of search to perform
The default value is SearchService.WEB_SEARCH.
This property can be used as the source for data binding.
| SearchService | () | constructor |
public function SearchService()Constructor.
| searchAlbums | () | method |
public function searchAlbums(params:SearchParams = null):voidSearch albums based on an album, album ID, artist, or artist ID.
Parametersparams:SearchParams (default = null) — SearchParams passed for using search filters.
|
| searchArtists | () | method |
public function searchArtists(params:SearchParams = null):voidSearch artists based on an artist or artist ID.
Parametersparams:SearchParams (default = null) — SearchParams passed for using search filters.
|
| searchAudio | () | method |
public function searchAudio(params:SearchParams = null):voidSearch audio based on a query.
Parametersparams:SearchParams (default = null) — SearchParams passed for using search filters.
|
| searchContextAnalysis | () | method |
public function searchContextAnalysis(params:SearchParams = null):voidSearch pages based on a query and context.
Parametersparams:SearchParams (default = null) — SearchParams passed for using search filters.
|
| searchImages | () | method |
public function searchImages(params:SearchParams = null):voidSearch images based on a query.
Parametersparams:SearchParams (default = null) — SearchParams passed for using search filters.
|
| searchLocal | () | method |
public function searchLocal(params:SearchParams = null):voidSearch local based on a query and location.
Parametersparams:SearchParams (default = null) — SearchParams passed for using search filters.
|
| searchNews | () | method |
public function searchNews(params:SearchParams = null):voidSearch news based on a query.
Parametersparams:SearchParams (default = null) — SearchParams passed for using search filters.
|
| searchPodcasts | () | method |
public function searchPodcasts(params:SearchParams = null):voidSearch podcasts based on a query.
Parametersparams:SearchParams (default = null) — SearchParams passed for using search filters.
|
| searchRelatedSuggestions | () | method |
public function searchRelatedSuggestions(params:SearchParams = null):voidSearch related suggestions based on a query.
Parametersparams:SearchParams (default = null) — SearchParams passed for using search filters.
|
| searchSongDownloads | () | method |
public function searchSongDownloads(params:SearchParams = null):voidSearch for places to download songs based on a song ID
Parametersparams:SearchParams (default = null) — SearchParams passed for using search filters.
|
| searchSongs | () | method |
public function searchSongs(params:SearchParams = null):voidSearch songs based on an song, song ID, album, album ID, artist, or artist ID.
Parametersparams:SearchParams (default = null) — SearchParams passed for using search filters.
|
| searchSpellingSuggestions | () | method |
public function searchSpellingSuggestions(params:SearchParams = null):voidSearch spelling suggestions based on a misspelled word.
Parametersparams:SearchParams (default = null) — SearchParams passed for using search filters.
|
| searchTermExtraction | () | method |
public function searchTermExtraction(params:SearchParams = null):voidSearch keywords based on context.
Parametersparams:SearchParams (default = null) — SearchParams passed for using search filters.
|
| searchVideos | () | method |
public function searchVideos(params:SearchParams = null):voidSearch video based on a query.
Parametersparams:SearchParams (default = null) — SearchParams passed for using search filters.
|
| searchWeb | () | method |
public function searchWeb(params:SearchParams = null):voidSearch pages based on a query.
Parametersparams:SearchParams (default = null) — SearchParams passed for using search filters.
|
| send | () | method |
public function send(parameters:Object = null):voidSearch based on type. This provides a way to use a standard method for search.
Note: Invoking the send() method multiple times with the same parameters will retrieve more results for that search.
parameters:Object (default = null) — A String or SearchParams object to specify parameters
|
See also
| fault | event |
com.yahoo.webapis.search.events.SearchFaultEvent
Dispatched after a fault occurs. This may happen due to incorrect parameters being sent.
| result | event |
com.yahoo.webapis.search.events.SearchResultEvent
Dispatched after a search is finished.
| ALBUM_SEARCH | constant |
public static const ALBUM_SEARCH:String = "album"The Album Search service allows you to find information on music albums.
| ARTIST_SEARCH | constant |
public static const ARTIST_SEARCH:String = "artist"The Artist Search service allows you to find information on a particular musical performer.
| AUDIO_SEARCH | constant |
public static const AUDIO_SEARCH:String = "audio"Yahoo! Audio Search Web Services provide access to music data and audio files using structured and unstructured queries.
| CONTEXT_ANALYSIS | constant |
public static const CONTEXT_ANALYSIS:String = "context"The Contextual Web Search service allows you to search the Internet for web pages using a context-based query.
| IMAGE_SEARCH | constant |
public static const IMAGE_SEARCH:String = "image"The Image Search Web Service allows you to search the Internet for images.
| LOCAL_SEARCH | constant |
public static const LOCAL_SEARCH:String = "local"Yahoo! Local Search APIs offer you a way to connect with the wealth of data in Yahoo! Local — including ratings and comments made by Yahoo! users. The content in Yahoo! Local makes a great addition to any mashup, bringing in location-based relevancy and the additional context of what real people have experienced in these places.
| NEWS_SEARCH | constant |
public static const NEWS_SEARCH:String = "news"The News Search service allows you to search the Internet for news stories.
| PODCAST_SEARCH | constant |
public static const PODCAST_SEARCH:String = "podcast"The Podcast Search service allows you to search the Internet for audio podcasts.
| RELATED_SUGGESTION | constant |
public static const RELATED_SUGGESTION:String = "related"The Related Suggestion service returns suggested queries to extend the power of a submitted query, providing variations on a theme to help you dig deeper.
| SONG_DOWNLOAD_LOCATION_SEARCH | constant |
public static const SONG_DOWNLOAD_LOCATION_SEARCH:String = "songDownload"The Song Download Location service allows you to find places to download individual songs, from the web, and from various online music sources.
| SONG_SEARCH | constant |
public static const SONG_SEARCH:String = "song"The Song Search service allows you to find information on individual songs.
| SPELLING_SUGGESTION | constant |
public static const SPELLING_SUGGESTION:String = "spellingSuggestion"The Spelling Suggestion service provides a suggested spelling correction for a given term.
| TERM_EXTRACTION | constant |
public static const TERM_EXTRACTION:String = "termExtraction"The Term Extraction Web Service provides a list of significant words or phrases extracted from a larger content. It is one of the technologies used in Y!Q.
| VIDEO_SEARCH | constant |
public static const VIDEO_SEARCH:String = "video"The Video Search service allows you to search the Internet for video clips.
| WEB_SEARCH | constant |
public static const WEB_SEARCH:String = "web"Yahoo! Web Search Web Services let you tap into the power of Yahoo! Search technologies from within other sites, applications, and environments.