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.

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

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

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

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

$request_base_url = ''
protected

The base URL for the HTTP request to retrieve data.

◆ $request_url_parameters

$request_url_parameters = []
protected

Additional URL parameters for the HTTP request to retrieve data.

◆ $settings

$settings = []
protected

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

◆ AUTHOR

const AUTHOR = 'author'

◆ ISBN

const ISBN = 'isbn'

◆ ISSN

const ISSN = 'issn'

◆ NUMBER

const NUMBER = 'number'

◆ ORDER_BY_RELEVANCE

const ORDER_BY_RELEVANCE = 'relevance'

◆ ORDER_BY_YEAR

const ORDER_BY_YEAR = 'year'

◆ PUBLICATION

const PUBLICATION = 'publication'

◆ SIGNATURE

const SIGNATURE = 'signature'

◆ TITLE

const TITLE = 'title'

◆ YEAR

const YEAR = 'year'

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