Stud.IP  5.4
 All Data Structures Namespaces Files Functions Variables Groups
LibrarySearch Class Reference
Inheritance diagram for LibrarySearch:
BASELibrarySearch K10PlusZentralLibrarySearch SRULibrarySearch

Public Member Functions

 __construct (array $configuration=[])
 
 query (array $search_parameters=[], string $order_by=self::ORDER_BY_RELEVANCE, int $limit=200)
 

Data Fields

const TITLE = 'title'
 
const AUTHOR = 'author'
 
const YEAR = 'year'
 
const NUMBER = 'number'
 
const ISSN = 'issn'
 
const ISBN = 'isbn'
 
const PUBLICATION = 'publication'
 
const SIGNATURE = 'signature'
 
const ORDER_BY_RELEVANCE = 'relevance'
 
const ORDER_BY_YEAR = 'year'
 

Protected Member Functions

 translateQueryFields (array $query_fields=[])
 
 requestData (string $base_url= '', array $url_parameters=[])
 

Protected Attributes

 $request_base_url = ''
 
 $request_url_parameters = []
 
 $settings = []
 

Detailed Description

This class contains basic methods for querying a library catalog using standardised search parameters.

Constructor & Destructor Documentation

__construct ( array  $configuration = [])

A basic constructor.

Parameters
array$configurationThe configuration for the LibrarySearch implementation. It should be an associative array with the following keys:
  • base_url: The base URL for retrieving data.
  • additional_url_parameters: Additional URL parameters for the base URL.
  • settings: Implementation-specific configuration. This should also be an associative array.

Member Function Documentation

query ( array  $search_parameters = [],
string  $order_by = self::ORDER_BY_RELEVANCE,
int  $limit = 200 
)
abstract

Starts a query to a library catalogue using the specified parameters. If standardised parameters as defined in the FIELD_ constants of this class are used as keys in the $search_parameters array, their keys may be converted to library-specific search keys.

Parameters
array$search_parametersThe search parameters to be used. The array must be an associative array where the keys represent the fields.
string$order_by
int$limitThe maximum amount of items that shall be retrieved from the catalog.
Returns
LibrarySearchResult[] An array of LibrarySearchResult items if entries matching the search could be found in the library.
requestData ( string  $base_url = '',
array  $url_parameters = [] 
)
protected

A common method for the libcurl code to request data from an URL so that LibrarySearch implementations don't have to include their own libcurl code to get data.

Parameters
string$base_urlThe base URL to request data from.
array$url_parametersURL parameters for the request. The array should consist of an associative array with keys representing the parameter name and the values representing the parameter values.
Returns
string|bool The result of the request. If the base URL is empty or no data could be retrieved due to an error, false is returned. In case of success, a string with the retrieved data is returned.
translateQueryFields ( array  $query_fields = [])
abstractprotected

This method shall replace the generalised search query fields with the implementation specific query fields.

Parameters
array$query_fieldsAn array with query parameters using the generalised query fields.
Returns
array The translated version of the $query_fields array.

Field Documentation

$request_base_url = ''
protected

The base URL for the HTTP request to retrieve data.

$request_url_parameters = []
protected

Additional URL parameters for the HTTP request to retrieve data.

$settings = []
protected

Implementation-specific configuration that can define the behavior of the LibrarySearch implementation.

const AUTHOR = 'author'
const ISBN = 'isbn'
const ISSN = 'issn'
const NUMBER = 'number'
const ORDER_BY_RELEVANCE = 'relevance'
const ORDER_BY_YEAR = 'year'
const PUBLICATION = 'publication'
const SIGNATURE = 'signature'
const TITLE = 'title'
const YEAR = 'year'

The documentation for this class was generated from the following file: