VuFind API Documentation

Connector
in package
implements LoggerAwareInterface Uses LoggerAwareTrait

SRU Search Interface

Tags
category

VuFind

author

Andrew S. Nagy vufind-tech@lists.sourceforge.net

license

http://opensource.org/licenses/gpl-2.0.php GNU General Public License

link

Wiki

Interfaces, Classes, Traits and Enums

LoggerAwareInterface

Table of Contents

$client  : Client
The HTTP_Request object used for REST transactions
$host  : string
The host to connect to
$raw  : bool
Whether to Serialize to a PHP Array or not.
$sruVersion  : string
The version to specify in the URL
__construct()  : mixed
Constructor
checkForHttpError()  : void
Check for HTTP errors in a response.
getMoreLikeThis()  : array<string|int, mixed>
Get records similar to one record
scan()  : string
Scan
sruSearch()  : array<string|int, mixed>
Search
call()  : string|SimpleXMLElement
Submit REST Request
debug()  : void
Log a debug message.
log()  : void
Send a message to the logger.
logError()  : void
Log an error message.
logWarning()  : void
Log a warning message.
process()  : string|SimpleXMLElement
Process an SRU response. Returns either the raw XML string or a SimpleXMLElement based on the contents of the class' raw property.

Properties

$client

The HTTP_Request object used for REST transactions

protected Client $client

$host

The host to connect to

protected string $host

$raw

Whether to Serialize to a PHP Array or not.

protected bool $raw = false

$sruVersion

The version to specify in the URL

protected string $sruVersion = '1.1'

Methods

__construct()

Constructor

public __construct(string $host, Client $client) : mixed

Sets up the SOAP Client

Parameters
$host : string

The URL of the SRU Server

$client : Client

An HTTP client object

Return values
mixed

checkForHttpError()

Check for HTTP errors in a response.

public checkForHttpError(Response $result) : void
Parameters
$result : Response

The response to check.

Tags
throws
BackendException
Return values
void

getMoreLikeThis()

Get records similar to one record

public getMoreLikeThis(array<string|int, mixed> $record, string $id[, int $max = 5 ]) : array<string|int, mixed>
Parameters
$record : array<string|int, mixed>

An associative array of the record data

$id : string

The record id

$max : int = 5

The maximum records to return; Default is 5

Return values
array<string|int, mixed>

An array of query results

scan()

Scan

public scan(string $clause[, int $pos = null ][, int $maxTerms = null ]) : string
Parameters
$clause : string

The CQL clause specifying the start point

$pos : int = null

The position of the start point in the response

$maxTerms : int = null

The maximum number of terms to return

Return values
string

XML response

sruSearch()

Search

public sruSearch(string $query[, string $start = 1 ][, string $limit = null ][, string $sortBy = null ][, string $schema = 'marcxml' ][, bool $process = true ]) : array<string|int, mixed>
Parameters
$query : string

The search query

$start : string = 1

The record to start with

$limit : string = null

The amount of records to return

$sortBy : string = null

The value to be used by for sorting

$schema : string = 'marcxml'

Record schema to use in results list

$process : bool = true

Process into array (true) or return raw (false)

Return values
array<string|int, mixed>

An array of query results

call()

Submit REST Request

protected call([string $method = 'GET' ][, array<string|int, mixed> $params = null ][, bool $process = true ]) : string|SimpleXMLElement
Parameters
$method : string = 'GET'

HTTP Method to use: GET or POST

$params : array<string|int, mixed> = null

An array of parameters for the request

$process : bool = true

Should we convert the MARCXML?

Return values
string|SimpleXMLElement

The response from the XServer

debug()

Log a debug message.

protected debug(string $msg[, array<string|int, mixed> $context = [] ][, bool $prependClass = true ]) : void
Parameters
$msg : string

Log message

$context : array<string|int, mixed> = []

Log context

$prependClass : bool = true

Prepend class name to message?

Return values
void

log()

Send a message to the logger.

protected log(string $level, string $message[, array<string|int, mixed> $context = [] ][, bool $prependClass = false ]) : void
Parameters
$level : string

Log level

$message : string

Log message

$context : array<string|int, mixed> = []

Log context

$prependClass : bool = false

Prepend class name to message?

Return values
void

logError()

Log an error message.

protected logError(string $msg[, array<string|int, mixed> $context = [] ][, bool $prependClass = true ]) : void
Parameters
$msg : string

Log message

$context : array<string|int, mixed> = []

Log context

$prependClass : bool = true

Prepend class name to message?

Return values
void

logWarning()

Log a warning message.

protected logWarning(string $msg[, array<string|int, mixed> $context = [] ][, bool $prependClass = true ]) : void
Parameters
$msg : string

Log message

$context : array<string|int, mixed> = []

Log context

$prependClass : bool = true

Prepend class name to message?

Return values
void

process()

Process an SRU response. Returns either the raw XML string or a SimpleXMLElement based on the contents of the class' raw property.

protected process(string $response) : string|SimpleXMLElement
Parameters
$response : string

SRU response

Return values
string|SimpleXMLElement

Search results