VuFind API Documentation

Backend extends AbstractBackend
in package
Uses SearchBackendEventManagerTrait

Blender backend.

Tags
category

VuFind

author

Ere Maijala ere.maijala@helsinki.fi

license

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

link
https://vufind.org

Table of Contents

$adaptiveBlockSizes  : array<string|int, mixed>
Adaptive block sizes for interleaved records
$backends  : array<string|int, mixed>
Actual backends
$blendLimit  : int
Limit for number of records to blend
$blockSize  : int
Block size for interleaved records
$collectionFactory  : RecordCollectionFactoryInterface
Record collection factory.
$config  : Config
Blender configuration
$events  : EventManager
Event manager.
$identifier  : string
Backend identifier.
$mappings  : array<string|int, mixed>
Mappings configuration
__construct()  : void
Constructor.
getEventManager()  : EventManagerInterface
Return EventManager instance.
getIdentifier()  : string
Return backend identifier.
getRecordCollectionFactory()  : RecordCollectionFactoryInterface
Return the record collection factory.
onSearchPost()  : EventInterface
Trigger post-search events for all backends.
onSearchPre()  : EventInterface
Trigger pre-search events for all backends.
retrieve()  : RecordCollectionInterface
Retrieve a single document.
search()  : RecordCollectionInterface
Perform a search and return record collection.
setEventManager()  : void
Set EventManager instance.
setIdentifier()  : void
Set the backend identifier.
setRecordCollectionFactory()  : void
Set the record collection factory.
collectEventResults()  : void
Collect results back into the Command after an event has been processed
convertSearchEvent()  : EventInterface
Convert a search event to another backend
createRecordCollection()  : RecordCollection
Create record collection.
debug()  : void
Log a debug message.
fillMergedCollection()  : void
Add records to the merged collection in a round-robin fashion up to the specified limit
getActiveBackends()  : array<string|int, mixed>
Get active backends for a search
getBlockSize()  : int
Get the block size for the given result count
getRecord()  : RecordInterface|null
Get next record from the given backend.
injectSourceIdentifier()  : RecordCollectionInterface
Inject source identifier in record collection and all contained records.
log()  : void
Send a message to the logger.
logError()  : void
Log an error message.
logWarning()  : void
Log a warning message.
processBackendFailures()  : void
Process any backend exceptions and throw an exception if all failed or add an error message if some of them failed.
triggerSearchEvent()  : EventInterface
Trigger pre-search events for all backends.

Properties

$adaptiveBlockSizes

Adaptive block sizes for interleaved records

protected array<string|int, mixed> $adaptiveBlockSizes

$backends

Actual backends

protected array<string|int, mixed> $backends

$blendLimit

Limit for number of records to blend

protected int $blendLimit

$blockSize

Block size for interleaved records

protected int $blockSize

$config

Blender configuration

protected Config $config

$events

Event manager.

protected EventManager $events

$mappings

Mappings configuration

protected array<string|int, mixed> $mappings

Methods

__construct()

Constructor.

public __construct(array<string|int, mixed> $backends, Config $config, array<string|int, mixed> $mappings, EventManager $events) : void
Parameters
$backends : array<string|int, mixed>

Actual backends

$config : Config

Blender configuration

$mappings : array<string|int, mixed>

Mappings configuration

$events : EventManager

Event manager

Return values
void

getEventManager()

Return EventManager instance.

public getEventManager() : EventManagerInterface

Lazy loads a new EventManager if none was set.

Return values
EventManagerInterface

getIdentifier()

Return backend identifier.

public getIdentifier() : string
Return values
string

getRecordCollectionFactory()

Return the record collection factory.

public getRecordCollectionFactory() : RecordCollectionFactoryInterface

Lazy loads a generic collection factory.

Return values
RecordCollectionFactoryInterface

onSearchPost()

Trigger post-search events for all backends.

public onSearchPost(EventInterface $event) : EventInterface
Parameters
$event : EventInterface

Event

Return values
EventInterface

onSearchPre()

Trigger pre-search events for all backends.

public onSearchPre(EventInterface $event) : EventInterface
Parameters
$event : EventInterface

Event

Return values
EventInterface

setEventManager()

Set EventManager instance.

public setEventManager(EventManagerInterface $events) : void
Parameters
$events : EventManagerInterface

Event manager

Return values
void

setIdentifier()

Set the backend identifier.

public setIdentifier(string $identifier) : void
Parameters
$identifier : string

Backend identifier

Return values
void

collectEventResults()

Collect results back into the Command after an event has been processed

protected collectEventResults(SearchCommand $command, SearchCommand $backendCommand, string $backendId) : void
Parameters
$command : SearchCommand

Search command

$backendCommand : SearchCommand

Backend-specific command

$backendId : string

Backend identifier

Return values
void

convertSearchEvent()

Convert a search event to another backend

protected convertSearchEvent(EventInterface $event, SearchCommand $command, BackendInterface $backend) : EventInterface
Parameters
$event : EventInterface

Event

$command : SearchCommand

Search command

$backend : BackendInterface

Target backend

Return values
EventInterface

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

fillMergedCollection()

Add records to the merged collection in a round-robin fashion up to the specified limit

protected fillMergedCollection(RecordCollectionInterface $mergedCollection, array<string|int, mixed> $collections, array<string|int, mixed> $backendDetails, array<string|int, mixed> $backendRecords, int $limit, int $blockSize) : void
Parameters
$mergedCollection : RecordCollectionInterface

Merged collection

$collections : array<string|int, mixed>

Source collections

$backendDetails : array<string|int, mixed>

Active backend details

$backendRecords : array<string|int, mixed>

Backend record buffers

$limit : int

Record limit

$blockSize : int

Block size

Return values
void

getActiveBackends()

Get active backends for a search

protected getActiveBackends(ParamBag|null $params, string $delimiter) : array<string|int, mixed>
Parameters
$params : ParamBag|null

Search backend parameters

$delimiter : string

Delimiter for the blender_backend facet

Return values
array<string|int, mixed>

getBlockSize()

Get the block size for the given result count

protected getBlockSize(int $resultCount) : int
Parameters
$resultCount : int

Result count

Return values
int

getRecord()

Get next record from the given backend.

protected getRecord(array<string|int, mixed> $backendDetails, array<string|int, mixed> &$backendRecords, int $offset, int $blockSize) : RecordInterface|null

Gets next records from the previously retrieved array of records or retrieves a new batch of records from the backend.

Parameters
$backendDetails : array<string|int, mixed>

Details for the backend

$backendRecords : array<string|int, mixed>

Record buffer

$offset : int

Record offset

$blockSize : int

Blending block size

Return values
RecordInterface|null

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

processBackendFailures()

Process any backend exceptions and throw an exception if all failed or add an error message if some of them failed.

protected processBackendFailures(RecordCollection $mergedCollection, array<string|int, mixed> $exceptions, bool $haveResults) : void
Parameters
$mergedCollection : RecordCollection

Result collection

$exceptions : array<string|int, mixed>

Exceptions

$haveResults : bool

Whether any results are available

Tags
throws
Exception
Return values
void

triggerSearchEvent()

Trigger pre-search events for all backends.

protected triggerSearchEvent(EventInterface $event) : EventInterface
Parameters
$event : EventInterface

Event

Return values
EventInterface

Search results