ConsortialVuFind
in package
implements
RecommendInterface, LoggerAwareInterface
Uses
LoggerAwareTrait
ConsortialVuFind Recommendations Module
This class searches a separate instance of VuFind via its public API and links to the record and results pages hosted within that instance. This is intended to search and link to a consortial catalog, such as ReShare, which uses its own VuFind instance to display consortium holdings and facilitate borrowing between institutions.
Tags
Interfaces, Classes, Traits and Enums
- RecommendInterface
- Search Recommendations Interface
- LoggerAwareInterface
Table of Contents
- $config : Config
- ConsortialVuFind.ini configuration
- $connection : ExternalVuFind
- Connection to consortial VuFind API
- $hasMinimumConfig : bool
- Boolean indicating if at least the minimal required configuration is present
- $limit : int
- Number of results to show
- $queryString : string|null
- Query string from the original search results
- $recordBaseUrl : string
- Base URL of a record page
- $requestParam : string
- Request parameter for the search query
- $resultsBaseUrl : string
- Base URL of a search results page
- $searchFilters : array<string|int, mixed>
- Any filters used in the search
- __construct() : mixed
- Constructor
- getMoreResultsUrl() : string
- Get a URL to the full search results page in the consortial VuFind instance.
- getResults() : array<string|int, mixed>
- Get the consortial VuFind instance's search results.
- init() : void
- Called before the Search Results object performs its main search (specifically, in response to \VuFind\Search\SearchRunner::EVENT_CONFIGURED).
- process() : void
- Called after the Search Results object has performed its main search. This may be used to extract necessary information from the Search Results object or to perform completely unrelated processing.
- setConfig() : void
- Store the configuration of the recommendation module.
- 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.
Properties
$config
ConsortialVuFind.ini configuration
protected
Config
$config
$connection
Connection to consortial VuFind API
protected
ExternalVuFind
$connection
$hasMinimumConfig
Boolean indicating if at least the minimal required configuration is present
protected
bool
$hasMinimumConfig
= false
$limit
Number of results to show
protected
int
$limit
= 5
$queryString
Query string from the original search results
protected
string|null
$queryString
= null
$recordBaseUrl
Base URL of a record page
protected
string
$recordBaseUrl
= null
$requestParam
Request parameter for the search query
protected
string
$requestParam
= 'lookfor'
$resultsBaseUrl
Base URL of a search results page
protected
string
$resultsBaseUrl
= null
$searchFilters
Any filters used in the search
protected
array<string|int, mixed>
$searchFilters
= []
Methods
__construct()
Constructor
public
__construct(Config $config, ExternalVuFind $connection) : mixed
Parameters
- $config : Config
-
ConsortialVuFind.ini configuration
- $connection : ExternalVuFind
-
Connection to consortial VuFind API
Return values
mixed —getMoreResultsUrl()
Get a URL to the full search results page in the consortial VuFind instance.
public
getMoreResultsUrl() : string
Return values
string —The url
getResults()
Get the consortial VuFind instance's search results.
public
getResults() : array<string|int, mixed>
Return values
array<string|int, mixed> —init()
Called before the Search Results object performs its main search (specifically, in response to \VuFind\Search\SearchRunner::EVENT_CONFIGURED).
public
init(Params $params, Parameters $request) : void
This method is responsible for setting search parameters needed by the recommendation module and for reading any existing search parameters that may be needed.
Parameters
- $params : Params
-
Search parameter object
- $request : Parameters
-
Parameter object representing user request.
Tags
Return values
void —process()
Called after the Search Results object has performed its main search. This may be used to extract necessary information from the Search Results object or to perform completely unrelated processing.
public
process(Results $results) : void
Parameters
- $results : Results
-
Search results object
Return values
void —setConfig()
Store the configuration of the recommendation module.
public
setConfig(string $settings) : void
Parameters
- $settings : string
-
Settings from searches.ini.
Return values
void —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?