Stud.IP  5.4
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()

__construct ( array  $configuration = [])

A basic constructor.

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()

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

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.

array$search_parametersThe search parameters to be used. The array must be an associative array where the keys represent the fields.
int$limitThe maximum amount of items that shall be retrieved from the catalog.
LibrarySearchResult[] An array of LibrarySearchResult items if entries matching the search could be found in the library.

◆ requestData()

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

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.

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.
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()

translateQueryFields ( array  $query_fields = [])

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

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

Field Documentation

◆ $request_base_url

$request_base_url = ''

The base URL for the HTTP request to retrieve data.

◆ $request_url_parameters

$request_url_parameters = []

Additional URL parameters for the HTTP request to retrieve data.

◆ $settings

$settings = []

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: