Backend
extends AbstractBackend
in package
Pazpar2 backend.
Tags
Table of Contents
- $collectionFactory : RecordCollectionFactoryInterface
- Record collection factory.
- $connector : Connector
- Connector.
- $identifier : string
- Backend identifier.
- $maxQueryTime : int
- The maximum amount of time to wait to reach $progressTarget (above) before giving up and accepting what is currently available. (Measured in seconds).
- $progressTarget : float
- How much search progress should be completed before returning results (a value between 0 and 1).
- $queryBuilder : QueryBuilder
- Query builder.
- __construct() : void
- Constructor.
- getConnector() : Connector
- Return the Summon connector.
- getIdentifier() : string
- Return backend identifier.
- getQueryBuilder() : QueryBuilder
- Return query builder.
- getRecordCollectionFactory() : RecordCollectionFactoryInterface
- Return the record collection factory.
- retrieve() : RecordCollectionInterface
- Retrieve a single document.
- search() : RecordCollectionInterface
- Perform a search and return record collection.
- setIdentifier() : void
- Set the backend identifier.
- setMaxQueryTime() : void
- Set the max query time.
- setQueryBuilder() : void
- Set the query builder.
- setRecordCollectionFactory() : void
- Set the record collection factory.
- setSearchProgressTarget() : void
- Set the search progress target.
- createRecordCollection() : RecordCollectionInterface
- Create record collection.
- debug() : void
- Log a debug message.
- getSearchProgress() : float
- Get progress on the current search operation.
- 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.
Properties
$collectionFactory
Record collection factory.
protected
RecordCollectionFactoryInterface
$collectionFactory
= null
$connector
Connector.
protected
Connector
$connector
$identifier
Backend identifier.
protected
string
$identifier
= null
$maxQueryTime
The maximum amount of time to wait to reach $progressTarget (above) before giving up and accepting what is currently available. (Measured in seconds).
protected
int
$maxQueryTime
= 60
$progressTarget
How much search progress should be completed before returning results (a value between 0 and 1).
protected
float
$progressTarget
= 1.0
$queryBuilder
Query builder.
protected
QueryBuilder
$queryBuilder
= null
Methods
__construct()
Constructor.
public
__construct(Connector $connector[, RecordCollectionFactoryInterface $factory = null ]) : void
Parameters
- $connector : Connector
-
Pazpar2 connector
- $factory : RecordCollectionFactoryInterface = null
-
Record collection factory
Return values
void —getConnector()
Return the Summon connector.
public
getConnector() : Connector
Return values
Connector —getIdentifier()
Return backend identifier.
public
getIdentifier() : string
Return values
string —getQueryBuilder()
Return query builder.
public
getQueryBuilder() : QueryBuilder
Lazy loads an empty QueryBuilder if none was set.
Return values
QueryBuilder —getRecordCollectionFactory()
Return the record collection factory.
public
getRecordCollectionFactory() : RecordCollectionFactoryInterface
Lazy loads a generic collection factory.
Return values
RecordCollectionFactoryInterface —retrieve()
Retrieve a single document.
public
retrieve(string $id[, ParamBag $params = null ]) : RecordCollectionInterface
Parameters
- $id : string
-
Document identifier
- $params : ParamBag = null
-
Search backend parameters
Return values
RecordCollectionInterface —search()
Perform a search and return record collection.
public
search(AbstractQuery $query, int $offset, int $limit[, ParamBag $params = null ]) : RecordCollectionInterface
Parameters
- $query : AbstractQuery
-
Search query
- $offset : int
-
Search offset
- $limit : int
-
Search limit
- $params : ParamBag = null
-
Search backend parameters
Return values
RecordCollectionInterface —setIdentifier()
Set the backend identifier.
public
setIdentifier(string $identifier) : void
Parameters
- $identifier : string
-
Backend identifier
Return values
void —setMaxQueryTime()
Set the max query time.
public
setMaxQueryTime(int $time) : void
Parameters
- $time : int
-
New value
Return values
void —setQueryBuilder()
Set the query builder.
public
setQueryBuilder(QueryBuilder $queryBuilder) : void
Parameters
- $queryBuilder : QueryBuilder
-
Query builder
Return values
void —setRecordCollectionFactory()
Set the record collection factory.
public
setRecordCollectionFactory(RecordCollectionFactoryInterface $factory) : void
Parameters
- $factory : RecordCollectionFactoryInterface
-
Factory
Return values
void —setSearchProgressTarget()
Set the search progress target.
public
setSearchProgressTarget(float $progress) : void
Parameters
- $progress : float
-
New value
Return values
void —createRecordCollection()
Create record collection.
protected
createRecordCollection(array<string|int, mixed> $records, int $total, int $offset) : RecordCollectionInterface
Parameters
- $records : array<string|int, mixed>
-
Records to process
- $total : int
-
Total result count
- $offset : int
-
Search offset
Tags
Return values
RecordCollectionInterface —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 —getSearchProgress()
Get progress on the current search operation.
protected
getSearchProgress() : float
Return values
float —injectSourceIdentifier()
Inject source identifier in record collection and all contained records.
protected
injectSourceIdentifier(RecordCollectionInterface $response) : RecordCollectionInterface
Parameters
- $response : RecordCollectionInterface
-
Response
Return values
RecordCollectionInterface —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?