DPLATerms
in package
implements
RecommendInterface
DPLATerms Recommendations Module
This class uses current search terms to query the DPLA API.
Tags
Interfaces, Classes, Traits and Enums
- RecommendInterface
- Search Recommendations Interface
Table of Contents
- $apiKey : string
- Config
- $client : Client
- VuFind HTTP Client
- $collapsed : bool
- Setting of initial collapsedness
- $formatMap : array<string|int, mixed>
- Map of Solr field names to equivalent API parameters
- $returnFields : array<string|int, mixed>
- List of fields to retrieve from the API
- $searchObject : Results
- Search results object
- __construct() : mixed
- Constructor
- getResults() : array<string|int, mixed>
- Get terms related to the query.
- init() : void
- Called before the Search Results object performs its main search (specifically, in response to \VuFind\Search\SearchRunner::EVENT_CONFIGURED).
- isCollapsed() : array<string|int, mixed>
- Return the list of facets configured to be collapsed
- 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.
- getApiInput() : array<string|int, mixed>
- Get input parameters for API call.
- processResults() : array<string|int, mixed>
- Process the API response.
Properties
$apiKey
Config
protected
string
$apiKey
$client
VuFind HTTP Client
protected
Client
$client
$collapsed
Setting of initial collapsedness
protected
bool
$collapsed
$formatMap
Map of Solr field names to equivalent API parameters
protected
array<string|int, mixed>
$formatMap
= ['author_facet' => 'sourceResource.creator', 'building' => 'provider.name', 'format' => 'sourceResource.format', 'geographic_facet' => 'sourceResource.spatial.region', 'institution' => 'provider.name', 'language' => 'sourceResource.language.name', 'publishDate' => 'sourceResource.date.begin']
$returnFields
List of fields to retrieve from the API
protected
array<string|int, mixed>
$returnFields
= ['id', 'dataProvider', 'sourceResource.title', 'sourceResource.description']
$searchObject
Search results object
protected
Results
$searchObject
Methods
__construct()
Constructor
public
__construct(string $apiKey, Client $client) : mixed
Parameters
- $apiKey : string
-
API key
- $client : Client
-
VuFind HTTP client
Return values
mixed —getResults()
Get terms related to the query.
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 —isCollapsed()
Return the list of facets configured to be collapsed
public
isCollapsed() : array<string|int, mixed>
Return values
array<string|int, mixed> —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 —getApiInput()
Get input parameters for API call.
protected
getApiInput() : array<string|int, mixed>
Return values
array<string|int, mixed> —processResults()
Process the API response.
protected
processResults(string $response) : array<string|int, mixed>
Parameters
- $response : string
-
API response