Backend
extends AbstractBackend
in package
implements
SimilarInterface, RetrieveBatchInterface, RandomInterface, ExtraRequestDetailsInterface, GetIdsInterface
SOLR backend.
Tags
Interfaces, Classes, Traits and Enums
- SimilarInterface
- MLT feature interface definition.
- RetrieveBatchInterface
- Optional backend feature: retrieve batch of records.
- RandomInterface
- Random record retrieval feature interface definition.
- ExtraRequestDetailsInterface
- Optional backend feature: Get more information about requests.
- GetIdsInterface
- Optional backend feature: Get identifiers of records.
Table of Contents
- $collectionFactory : RecordCollectionFactoryInterface
- Record collection factory.
- $connector : Connector
- Connector.
- $identifier : string
- Backend identifier.
- $pageSize : int
- Limit for records per query in a batch retrieval.
- $queryBuilder : QueryBuilder
- Query builder.
- $similarBuilder : SimilarBuilder
- Similar records query builder.
- __construct() : void
- Constructor.
- alphabeticBrowse() : array<string|int, mixed>
- Obtain information from an alphabetic browse index.
- getConnector() : Connector
- Return the SOLR connector.
- getExtraRequestDetails() : array<string|int, mixed>
- Returns some extra details about the search.
- getIdentifier() : string
- Return backend identifier.
- getIds() : RecordCollectionInterface
- Perform a search and return record collection of only record identifiers.
- getQueryBuilder() : QueryBuilder
- Return query builder.
- getRecordCollectionFactory() : RecordCollectionFactoryInterface
- Return the record collection factory.
- getSimilarBuilder() : SimilarBuilder
- Return similar records query builder.
- random() : RecordCollectionInterface
- Get Random records
- rawJsonSearch() : string
- Perform a search and return a raw response.
- resetExtraRequestDetails() : void
- Clears all accumulated extra request details
- retrieve() : RecordCollectionInterface
- Retrieve a single document.
- retrieveBatch() : RecordCollectionInterface
- Retrieve a batch of documents.
- search() : RecordCollectionInterface
- Perform a search and return record collection.
- setIdentifier() : void
- Set the backend identifier.
- setPageSize() : void
- Set the limit for batch queries
- setQueryBuilder() : void
- Set the query builder.
- setRecordCollectionFactory() : void
- Set the record collection factory.
- setSimilarBuilder() : void
- Set the similar records query builder.
- similar() : RecordCollectionInterface
- Return similar records.
- terms() : Terms
- Return terms from SOLR index.
- writeDocument() : array<string|int, mixed>
- Write a document to Solr. Return an array of details about the updated index.
- createRecordCollection() : RecordCollectionInterface
- Create record collection.
- debug() : void
- Log a debug message.
- deserialize() : array<string|int, mixed>
- Deserialize JSON response.
- injectResponseWriter() : void
- Inject response writer and named list implementation into parameters.
- 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.
- refineBrowseException() : void
- Improve the exception message for alphaBrowse errors when appropriate.
- workKeysSearch() : RecordCollectionInterface
- Return work expressions.
Properties
$collectionFactory
Record collection factory.
protected
RecordCollectionFactoryInterface
$collectionFactory
= null
$connector
Connector.
protected
Connector
$connector
$identifier
Backend identifier.
protected
string
$identifier
= null
$pageSize
Limit for records per query in a batch retrieval.
protected
int
$pageSize
= 100
$queryBuilder
Query builder.
protected
QueryBuilder
$queryBuilder
= null
$similarBuilder
Similar records query builder.
protected
SimilarBuilder
$similarBuilder
= null
Methods
__construct()
Constructor.
public
__construct(Connector $connector) : void
Parameters
- $connector : Connector
-
SOLR connector
Return values
void —alphabeticBrowse()
Obtain information from an alphabetic browse index.
public
alphabeticBrowse(string $source, string $from, int $page[, int $limit = 20 ][, ParamBag $params = null ], int $offsetDelta) : array<string|int, mixed>
Parameters
- $source : string
-
Name of index to search
- $from : string
-
Starting point for browse results
- $page : int
-
Result page to return (starts at 0)
- $limit : int = 20
-
Number of results to return on each page
- $params : ParamBag = null
-
Additional parameters
- $offsetDelta : int
-
Delta to use when calculating page offset (useful for showing a few results above the highlighted row)
Return values
array<string|int, mixed> —getConnector()
Return the SOLR connector.
public
getConnector() : Connector
Return values
Connector —getExtraRequestDetails()
Returns some extra details about the search.
public
getExtraRequestDetails() : array<string|int, mixed>
Return values
array<string|int, mixed> —getIdentifier()
Return backend identifier.
public
getIdentifier() : string
Return values
string —getIds()
Perform a search and return record collection of only record identifiers.
public
getIds(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 —getQueryBuilder()
Return query builder.
public
getQueryBuilder() : QueryBuilder
Lazy loads an empty default 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 —getSimilarBuilder()
Return similar records query builder.
public
getSimilarBuilder() : SimilarBuilder
Lazy loads an empty default SimilarBuilder if none was set.
Return values
SimilarBuilder —random()
Get Random records
public
random(AbstractQuery $query, int $limit[, ParamBag $params = null ]) : RecordCollectionInterface
Parameters
- $query : AbstractQuery
-
Search query
- $limit : int
-
Search limit
- $params : ParamBag = null
-
Search backend parameters
Return values
RecordCollectionInterface —rawJsonSearch()
Perform a search and return a raw response.
public
rawJsonSearch(AbstractQuery $query, int $offset, int $limit[, ParamBag $params = null ]) : string
Parameters
- $query : AbstractQuery
-
Search query
- $offset : int
-
Search offset
- $limit : int
-
Search limit
- $params : ParamBag = null
-
Search backend parameters
Return values
string —resetExtraRequestDetails()
Clears all accumulated extra request details
public
resetExtraRequestDetails() : void
Return values
void —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 —retrieveBatch()
Retrieve a batch of documents.
public
retrieveBatch(array<string|int, mixed> $ids[, ParamBag $params = null ]) : RecordCollectionInterface
Parameters
- $ids : array<string|int, mixed>
-
Array of document identifiers
- $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 —setPageSize()
Set the limit for batch queries
public
setPageSize(int $pageSize) : void
Parameters
- $pageSize : int
-
Records per Query
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 —setSimilarBuilder()
Set the similar records query builder.
public
setSimilarBuilder(SimilarBuilder $similarBuilder) : void
Parameters
- $similarBuilder : SimilarBuilder
-
Similar builder
Return values
void —similar()
Return similar records.
public
similar(string $id[, ParamBag $params = null ]) : RecordCollectionInterface
Parameters
- $id : string
-
Id of record to compare with
- $params : ParamBag = null
-
Search backend parameters
Return values
RecordCollectionInterface —terms()
Return terms from SOLR index.
public
terms([string $field = null ][, string $start = null ][, int $limit = null ][, ParamBag $params = null ]) : Terms
Parameters
- $field : string = null
-
Index field
- $start : string = null
-
Starting term (blank for beginning of list)
- $limit : int = null
-
Maximum number of terms
- $params : ParamBag = null
-
Additional parameters
Return values
Terms —writeDocument()
Write a document to Solr. Return an array of details about the updated index.
public
writeDocument(DocumentInterface $doc[, int|null $timeout = null ][, string $handler = 'update' ][, ParamBag|null $params = null ]) : array<string|int, mixed>
Parameters
- $doc : DocumentInterface
-
Document to write
- $timeout : int|null = null
-
Timeout value (null for default)
- $handler : string = 'update'
-
Handler to use
- $params : ParamBag|null = null
-
Search backend parameters
Return values
array<string|int, mixed> —createRecordCollection()
Create record collection.
protected
createRecordCollection(string $json) : RecordCollectionInterface
Parameters
- $json : string
-
Serialized JSON response
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 —deserialize()
Deserialize JSON response.
protected
deserialize(string $json) : array<string|int, mixed>
Parameters
- $json : string
-
Serialized JSON response
Tags
Return values
array<string|int, mixed> —injectResponseWriter()
Inject response writer and named list implementation into parameters.
protected
injectResponseWriter(ParamBag $params) : void
Parameters
- $params : ParamBag
-
Parameters
Tags
Return values
void —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?
Return values
void —refineBrowseException()
Improve the exception message for alphaBrowse errors when appropriate.
protected
refineBrowseException(RemoteErrorException $e) : void
Parameters
- $e : RemoteErrorException
-
Exception to clean up
Tags
Return values
void —workKeysSearch()
Return work expressions.
protected
workKeysSearch(WorkKeysQuery $query, int $offset, int $limit[, ParamBag $defaultParams = null ]) : RecordCollectionInterface
Parameters
- $query : WorkKeysQuery
-
Search query
- $offset : int
-
Search offset
- $limit : int
-
Search limit
- $defaultParams : ParamBag = null
-
Search backend parameters