Packagecom.brightcove.api.search
Classpublic class VideoSearch
InheritanceVideoSearch Inheritance flash.events.EventDispatcher

Interface with backend search of all titles in a single account, allowing for simple paging of data and memory management.



Public Methods
 MethodDefined By
  
VideoSearch(videoSearch:Object)
Constructor.
VideoSearch
  
addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = true):void
[override] Adds a listener for an event.
VideoSearch
  
findAllVideos(pageSize:uint = 20, pageNumber:uint = 0, sortBy:String = null, sortOrder:String = null, getItemCount:Boolean = false):void
Find all videos belonging to a particular publisher id.
VideoSearch
  
findRelatedVideos(videoID:Number, pageSize:uint = 20, pageNumber:uint = 0, getItemCount:Boolean = false):void
Finds videos related to the given video.
VideoSearch
  
findVideosByTags(andTags:Array = null, orTags:Array = null, pageSize:uint = 20, pageNumber:uint = 0, sortBy:String = null, sortOrder:String = null, getItemCount:Boolean = false):void
Performs a search on all the tags of the videos in this account, and returns a collection of videos that contain the specified tags.
VideoSearch
  
findVideosByText(text:String, pageSize:uint = 20, pageNumber:uint = 0, getItemCount:Boolean = false):void
Performs a search through all the given publisher's videos, and returns a collection of videos that match the specified text.
VideoSearch
  
getItems():Array
Returns the current page of items in the result set.
VideoSearch
  
The maximum number of pages in the VideoSearch instance that will be stored before being automatically purged by the VideoSearch instance.
VideoSearch
  
getNextPage():Array
Retrieves the next page in the result set based on the current index position.
VideoSearch
  
Retrieves the next page in the result set based on the current index position.
VideoSearch
  
getPage(pageIndex:uint):Array
Returns the specified page in the result set.
VideoSearch
  
getPageAsynch(pageIndex:uint):void
Retrieves the specified page in the result set.
VideoSearch
  
The last page retrieved from the VideoSearch instance.
VideoSearch
  
The maximum number of titles (rows) returned on each page of the search result set.
VideoSearch
  
Retrieves the previous page in the result set based on the current index position.
VideoSearch
  
Retrieves the previous page in the result set based on the current index position.
VideoSearch
  
getRow(rowIndex:uint):VideoDTO
Returns the specified row from the entire result set.
VideoSearch
  
getRowOnPage(rowIndex:uint, pageIndex:uint):VideoDTO
Returns the specified row from the specified page in the result set.
VideoSearch
  
The total number of pages in the search result set.
VideoSearch
  
The total number of rows in the search result set.
VideoSearch
  
purgeAll():void
Removes all stored references to all previously retrieved pages.
VideoSearch
  
purgePage(pageIndex:uint):void
Removes the stored reference to the specified page.
VideoSearch
  
removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void
[override] Removes a listener for an event.
VideoSearch
  
setMaxPagesInMemory(max:uint):void
The maximum number of pages in the VideoSearch instance that will be stored before being automatically purged by the VideoSearch instance.
VideoSearch
Events
 Event Summary Defined By
  Dispatched when an error occurs when performing a search.VideoSearch
  Dispatched when a successful search result is returned.VideoSearch
Constructor Detail
VideoSearch()Constructor
public function VideoSearch(videoSearch:Object)

Constructor.

Parameters
videoSearch:Object — internal VideoSearch object in the player.
Method Detail
addEventListener()method
override public function addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = true):void

Adds a listener for an event.

Parameters

type:String — AS3 docs.
 
listener:Function — AS3 docs.
 
useCapture:Boolean (default = false) — AS3 docs.
 
priority:int (default = 0) — AS3 docs.
 
useWeakReference:Boolean (default = true) — AS3 docs.

findAllVideos()method 
public function findAllVideos(pageSize:uint = 20, pageNumber:uint = 0, sortBy:String = null, sortOrder:String = null, getItemCount:Boolean = false):void

Find all videos belonging to a particular publisher id.

Parameters

pageSize:uint (default = 20) — of page. Number of entries returned.
 
pageNumber:uint (default = 0) — page to retrieve.
 
sortBy:String (default = null) — to sort the results.
 
sortOrder:String (default = null) — for results.
 
getItemCount:Boolean (default = false) — retrieve the number of videos matching your search criteria.

findRelatedVideos()method 
public function findRelatedVideos(videoID:Number, pageSize:uint = 20, pageNumber:uint = 0, getItemCount:Boolean = false):void

Finds videos related to the given video. Does a search based on short description, tags, and display name of all videos from this publisher. If the video has nothing related to it, this function will still return videos for being associated with that publisher.

Parameters

videoID:Number — ID of the video we'd like related videos for.
 
pageSize:uint (default = 20) — of page. Number of entries returned.
 
pageNumber:uint (default = 0) — page to retrieve.
 
getItemCount:Boolean (default = false) — retrieve the number of videos matching your search criteria.

findVideosByTags()method 
public function findVideosByTags(andTags:Array = null, orTags:Array = null, pageSize:uint = 20, pageNumber:uint = 0, sortBy:String = null, sortOrder:String = null, getItemCount:Boolean = false):void

Performs a search on all the tags of the videos in this account, and returns a collection of videos that contain the specified tags. Note that tags are case-sensitive.

Parameters

andTags:Array (default = null) — the results to those that contain all of these tags.
 
orTags:Array (default = null) — the results to those that contain at least one of these tags.
 
pageSize:uint (default = 20) — of page. Number of entries returned.
 
pageNumber:uint (default = 0) — page to retrieve.
 
sortBy:String (default = null) — to sort the results.
 
sortOrder:String (default = null) — for results.
 
getItemCount:Boolean (default = false) — retrieve the number of videos matching your search criteria.

findVideosByText()method 
public function findVideosByText(text:String, pageSize:uint = 20, pageNumber:uint = 0, getItemCount:Boolean = false):void

Performs a search through all the given publisher's videos, and returns a collection of videos that match the specified text.

Parameters

text:String — text we're searching with.
 
pageSize:uint (default = 20) — of page. Number of entries returned.
 
pageNumber:uint (default = 0) — page to retrieve.
 
getItemCount:Boolean (default = false) — retrieve the number of videos matching your search criteria.

getItems()method 
public function getItems():Array

Returns the current page of items in the result set.

Returns
Array — An array of VideoDTOs.

Throws
Generic — Error instance thrown if page has not been retrieved.
getMaxPagesInMemory()method 
public function getMaxPagesInMemory():uint

The maximum number of pages in the VideoSearch instance that will be stored before being automatically purged by the VideoSearch instance. Once the maxPagesInMemeory is reached, pages will be purged in a FIFO method.

Returns
uint — The maximum number of pages in the VideoSearch instance.
getNextPage()method 
public function getNextPage():Array

Retrieves the next page in the result set based on the current index position.

Returns
Array — The array of videos from the next page of the search result.

Throws
Generic — Error instance thrown if previous page does not exist.
getNextPageAsynch()method 
public function getNextPageAsynch():void

Retrieves the next page in the result set based on the current index position. If the page has not yet been retrieved from the server, the backend service is called and the result is sent to the searchResult handler. Otherwise, searchResult is fired immediately with the previously fetched page.


Throws
Generic — Error instance thrown if previous page does not exist.
getPage()method 
public function getPage(pageIndex:uint):Array

Returns the specified page in the result set. If the page has not yet been retrieved from the server, an Error is thrown.

Parameters

pageIndex:uint — numeric index of the page to return.

Returns
Array — An array of VideoDTOs.

Throws
Generic — Error instance thrown if page has not been retrieved.
getPageAsynch()method 
public function getPageAsynch(pageIndex:uint):void

Retrieves the specified page in the result set. If the page has not yet been retrieved from the server, the backend service is called and the result is sent to the searchResult handler. Otherwise, searchResult is fired immediately with the previously fetched page.

Parameters

pageIndex:uint — numeric index of the page to retrieve.

getPageNumber()method 
public function getPageNumber():uint

The last page retrieved from the VideoSearch instance.

Returns
uint — The last page retrieved from the VideoSearch instance.
getPageSize()method 
public function getPageSize():uint

The maximum number of titles (rows) returned on each page of the search result set.

Returns
uint — The maximum number of titles (rows) returned on each page of the search result set.
getPreviousPage()method 
public function getPreviousPage():Array

Retrieves the previous page in the result set based on the current index position.

Returns
Array — The array of videos from the previous page of the search result.

Throws
Generic — Error instance thrown if previous page does not exist.
getPreviousPageAsynch()method 
public function getPreviousPageAsynch():void

Retrieves the previous page in the result set based on the current index position. If the page has not yet been retrieved from the server, the backend service is called and the result is sent to the searchResult handler. Otherwise, searchResult is fired immediately with the previously fetched page.


Throws
Generic — Error instance thrown if previous page does not exist.
getRow()method 
public function getRow(rowIndex:uint):VideoDTO

Returns the specified row from the entire result set. If the page containing the row has not yet been retrieved from the server, an Error is thrown.

Parameters

rowIndex:uint — numeric index of the row in the entire result set to return.

Returns
VideoDTO — A VideoDTO.

Throws
Generic — Error instance thrown if page containing the row has not been retrieved.
getRowOnPage()method 
public function getRowOnPage(rowIndex:uint, pageIndex:uint):VideoDTO

Returns the specified row from the specified page in the result set. If the page containing the row has not yet been retrieved from the server, an Error is thrown.

Parameters

rowIndex:uint — numeric index of the row to return on a specified page.
 
pageIndex:uint — numeric index of the page from which to return a row.

Returns
VideoDTO — A VideoDTO.

Throws
Generic — Error instance thrown if page containing the row has not been retrieved.
getTotalPages()method 
public function getTotalPages():uint

The total number of pages in the search result set.

Returns
uint — The total number of pages in the search result set.
getTotalRows()method 
public function getTotalRows():uint

The total number of rows in the search result set.

Returns
uint — The total number of rows in the search result set.
purgeAll()method 
public function purgeAll():void

Removes all stored references to all previously retrieved pages.

purgePage()method 
public function purgePage(pageIndex:uint):void

Removes the stored reference to the specified page.

Parameters

pageIndex:uint — index of the page to purge from memory.

removeEventListener()method 
override public function removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void

Removes a listener for an event.

Parameters

type:String — AS3 docs.
 
listener:Function — AS3 docs.
 
useCapture:Boolean (default = false) — AS3 docs.

setMaxPagesInMemory()method 
public function setMaxPagesInMemory(max:uint):void

The maximum number of pages in the VideoSearch instance that will be stored before being automatically purged by the VideoSearch instance. Once the maxPagesInMemeory is reached, pages will be purged in a FIFO method.

Parameters

max:uint — maximum number of pages in the VideoSearch instance.

Event Detail
searchError Event
Event Object Type: com.brightcove.api.events.SearchEvent
SearchEvent.type property = com.brightcove.api.events.SearchEvent.ERROR

Dispatched when an error occurs when performing a search.

The SearchEvent.ERROR constant defines the value of the type property of the event object for a searchError event.
searchResult Event  
Event Object Type: com.brightcove.api.events.SearchEvent
SearchEvent.type property = com.brightcove.api.events.SearchEvent.RESULT

Dispatched when a successful search result is returned.

The SearchEvent.RESULT constant defines the value of the type property of the event object for a searchResult event.