Class Golem_Api_Article_Search

Description

Class for searching of articles via web interface.

Located in /Api/Article/Search.php (line 52)


	
			
Class Constant Summary
 URL = 'http://api.golem.de/api/article/search/'
Variable Summary
Array $articles
Integer $itemsPerPage
String $query
Integer $startIndex
String $totalResults
Method Summary
Golem_Api_Article_Search __construct (String $key)
Boolean fetch ([Array $curlOptions = array()])
Array getArticles ()
Integer getItemsPerPage ()
Integer getStartIndex ()
Integer getTotalResults ()
void setItemsPerPage (Integer $itemsPerPage)
void setQuery (String $query)
void setStartIndex (Integer $startIndex)
Variables
Array $articles = array() (line 84)

Article date

  • access: protected
Integer $itemsPerPage = 10 (line 96)

Number of article records to show with the request = "page"

  • access: protected
String $query = '' (line 90)

The search query

  • access: protected
Integer $startIndex = 1 (line 102)

The "page" to show

  • access: protected
String $totalResults = -1 (line 108)

The total number of results for a search query

  • access: protected
Methods
Constructor __construct (line 115)

Creates the ArticleSearch object

  • access: public
Golem_Api_Article_Search __construct (String $key)
  • String $key: the developer key
fetch (line 254)

Does the request to do the search.

If the request was succesful, true will be returned, else an exception will be thrown.

The possible Exception codes are Golem_Request::DATABASE, Golem_Api_Article_Search::ERROR_WORD_TOO_SHORT, Golem_Api_Article_Search::ERROR_WORD_TOO_LONG, Golem_Api_Article_Search::ERROR_QUERY_TOO_LONG, Golem_Api_Article_Search::ERROR_TOO_MUCH_WORDS.

After a successful request the articles are available from getArticles()

  • return: true, if request was successful
  • access: public
Boolean fetch ([Array $curlOptions = array()])
  • Array $curlOptions: optional options for cUrl
getArticles (line 228)

Returns the list of articles.

In the array, each entry represents a article record. The keys of record array are:

  • articleid
  • headline
  • abstracttext
  • url
  • date
  • leadimg is an array with the keys:
    • url
    • height
    • width

  • access: public
Array getArticles ()
getItemsPerPage (line 158)

Returns the number of articles to get per request

After a succesful fetch(), the value could be updated to a value actually used by the service.

  • return: the number of items to get per request
  • access: public
Integer getItemsPerPage ()
getStartIndex (line 187)

Returns the request page

After a succesful fetch(), the value could be updated to a value actually used by the service.

  • return: the request page
  • access: public
Integer getStartIndex ()
getTotalResults (line 199)

Returns the number of total results from the search query

  • return: the number of results
  • access: public
Integer getTotalResults ()
setItemsPerPage (line 143)

Sets the number of articles to get per request

  • access: public
void setItemsPerPage (Integer $itemsPerPage)
  • Integer $itemsPerPage: number of articles
setQuery (line 129)

Sets the query for the search request

  • access: public
void setQuery (String $query)
  • String $query: the search query to execute
setStartIndex (line 172)

Sets the request page

  • access: public
void setStartIndex (Integer $startIndex)
  • Integer $startIndex: the page to request
Class Constants
ERROR_QUERY_TOO_LONG = 14 (line 73)

Error code for a search query too long

ERROR_TOO_MUCH_WORDS = 15 (line 78)

Error code for too much search words in the search query

ERROR_WORD_TOO_LONG = 13 (line 68)

Error code for a word in the search query is too long

ERROR_WORD_TOO_SHORT = 12 (line 63)

Error code for a word in the search query is too short

URL = 'http://api.golem.de/api/article/search/' (line 58)

Base url of the webservice

Documentation generated on Tue, 20 Apr 2010 14:21:08 +0200 by phpDocumentor 1.4.3