VuFind API Documentation

SearchApiController extends AbstractSearch
in package
implements ApiInterface Uses ApiTrait

Search API Controller

Controls the Search API functionality

Tags
category

VuFind

author

Ere Maijala ere.maijala@helsinki.fi

author

Juha Luoma juha.luoma@helsinki.fi

license

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

link

Wiki

Interfaces, Classes, Traits and Enums

ApiInterface
Additional functionality for API controllers.

Table of Contents

$accessDeniedBehavior  : string
Behavior when access is denied (used unless overridden through permissionBehavior.ini). Valid values are 'promptLogin' and 'exception'.
$accessPermission  : string|bool|null
Permission that must be granted to access this module (false for no restriction, null to use configured default (which is usually the same as false)).
$defaultRecordFields  : array<string|int, mixed>
Default record fields to return if a request does not define the fields
$facetFormatter  : FacetFormatter
Facet formatter
$indexLabel  : string
Descriptive label for the index managed by this controller
$jsonpCallback  : string
Callback function in JSONP mode
$jsonPrettyPrint  : bool
Whether to pretty-print JSON
$maxLimit  : int
Max limit of search results in API response (default 100);
$modelPrefix  : string
Prefix for use in model names used by API
$outputMode  : string
Type of output to use
$recordAccessPermission  : string
Permission required for the record endpoint
$recordFormatter  : RecordFormatter
Record formatter
$recordRoute  : string
Record route uri
$rememberSearch  : bool
Should we remember the search for breadcrumb purposes?
$saveToHistory  : bool
Should we save searches to history?
$searchAccessPermission  : string
Permission required for the search endpoint
$searchClassId  : string
Search class family to use.
$searchRoute  : string
Search route uri
$serviceLocator  : ServiceLocatorInterface
Service manager
$translator  : TranslatorInterface
Translator
__construct()  : mixed
Constructor
advancedAction()  : ViewModel
Handle an advanced search
captcha()  : Captcha
confirm()  : mixed
Confirm an action.
dbUpgrade()  : DbUpgrade
facetListAction()  : mixed
Returns a list of all items associated with one facet for the lightbox
flashMessenger()  : FlashMessenger
followup()  : Followup
forceLogin()  : mixed
Redirect the user to the login screen.
forwardTo()  : mixed
Convenience method to make invocation of forward() helper less verbose.
getAccessPermission()  : string|bool|null
Getter for access permission (string for required permission name, false for no permission required, null to use default permission).
getApiSpecFragment()  : string
Get API specification JSON fragment for services provided by the controller
getConfig()  : Config
Get a VuFind configuration.
getDbService()  : T
Get a database service object.
getILS()  : Connection
Get the ILS connection.
getOptionsForClass()  : Options
Get proper options file for search class
getRecordCache()  : Cache
Get the record cache
getRecordLoader()  : Loader
Get the record loader
getRecordRouter()  : Router
Get the record router.
getRequest()  : Request
Get request object
getSearchMemory()  : Memory
Get the search memory
getServerUrl()  : string
Get the full URL to one of VuFind's routes.
getTable()  : Gateway
Get a database table object.
getTranslator()  : TranslatorInterface
Get translator object.
getTranslatorLocale()  : string
Get the locale from the translator.
holds()  : Holds
homeAction()  : mixed
Home action
ILLRequests()  : ILLRequests
ilsRecords()  : IlsRecords
newItems()  : NewItems
onDispatch()  : mixed
Execute the request
permission()  : Permission
recordAction()  : Response
Record action
renewals()  : Renewals
reserves()  : Reserves
resultsAction()  : ResponseInterface|ViewModel
Send search results to results view
resultScroller()  : ResultScroller
searchAction()  : Response
Search action
setAccessPermission()  : void
Getter for access permission.
setTranslator()  : TranslatorAwareInterface
Set a translator
storageRetrievalRequests()  : StorageRetrievalRequests
translate()  : string
Translate a string (or string-castable object)
translateWithPrefix()  : string
Translate a string (or string-castable object) using a prefix, or without the prefix if a prefixed translation is not found.
validateAccessPermission()  : void
Use preDispatch event to block access when appropriate.
attachDefaultListeners()  : void
Register the default events for this controller
catalogLogin()  : bool|array<string|int, mixed>|ViewModel
Does the user have catalog credentials available? Returns associative array of patron data if so, otherwise forwards to appropriate login prompt and returns false. If there is an ILS exception, a flash message is added and a newly created ViewModel is returned.
clearFollowupUrl()  : void
Sometimes we need to unset the followup to trigger default behaviors
commentsEnabled()  : bool
Are comments enabled?
createEmailViewModel()  : ViewModel
Create a new ViewModel to use as an email form.
createViewModel()  : ViewModel
Create a new ViewModel.
determineOutputMode()  : void
Determine the correct output mode based on content negotiation or the view parameter
disableSessionWrites()  : void
Prevent session writes -- this is designed to be called prior to time- consuming AJAX operations to help reduce the odds of a timing-related bug that causes the wrong version of session data to be written to disk (see VUFIND-716 for more details).
extractTextDomain()  : array<string|int, mixed>
Given a translation string with or without a text domain, return an array with the raw string and the text domain separated.
formWasSubmitted()  : bool
Check to see if a form was submitted from its post value Also validate the Captcha, if it's activated
getActiveRecommendationSettings()  : array<string|int, mixed>
Get active recommendation module settings
getAllRangeSettings()  : array<string|int, mixed>
Get all active range facets:
getAndClearFollowupUrl()  : string
Retrieve a referer to keep post-login redirect pointing to an appropriate location.
getAuthManager()  : Manager
Get the account manager object.
getAuthorizationService()  : AuthorizationService
Get the authorization service (note that we're doing this on-demand rather than through injection with the AuthorizationServiceAwareInterface to minimize expensive initialization when authorization is not needed.
getDateRangeSettings()  : array<string|int, mixed>
Get the current settings for the date range facets, if set:
getDebugTranslation()  : string
Build a debug-mode translation
getFieldList()  : array<string|int, mixed>
Get field list based on the request
getFullDateRangeSettings()  : array<string|int, mixed>
Get the current settings for the full date range facets, if set:
getGenericRangeSettings()  : array<string|int, mixed>
Get the current settings for the generic range facets, if set:
getHierarchicalFacetData()  : array<string|int, mixed>
Get hierarchical facet data for the given facet fields
getILSAuthenticator()  : ILSAuthenticator
Get the ILS authenticator.
getILSLoginMethod()  : string
What login method does the ILS use (password, email, vufind)
getILSLoginSettings()  : array<string|int, mixed>
Get settings required for displaying the catalog login form
getNumericRangeSettings()  : array<string|int, mixed>
Get the current settings for the numeric range facets, if set:
getRangeFieldList()  : array<string|int, mixed>
Get the range facet configurations from the specified config section and filter them appropriately.
getRangeSettings()  : array<string|int, mixed>
Get the current settings for the specified range facet, if it is set:
getRecordTabManager()  : TabManager
Get the tab configuration for this controller.
getRedirectForRecord()  : Response
Get a redirection response to a single record
getRefreshResponse()  : Response
Construct an HTTP 205 (refresh) response. Useful for reporting success in the lightbox without actually rendering content.
getResultsManager()  : PluginManager
Convenience method for accessing results
getRssSearchResponse()  : ResponseInterface
Support method for getSearchResultsView() -- return the search results reformatted as an RSS feed.
getSearchResultsView()  : ResponseInterface|ViewModel
Perform a search and send results to a results view
getSearchSetupCallback()  : mixed
Get a callback for setting up a search (or null if callback is unnecessary).
getUser()  : UserEntityInterface|null
Get the user object if logged in, false otherwise.
getViewRenderer()  : RendererInterface
Get the view renderer
hasFollowupUrl()  : bool
Checks if a followup url is set
inLightbox()  : bool
Are we currently in a lightbox context?
isAccessDenied()  : Response|bool
Check whether access is denied and return the appropriate message or false.
isLocalUrl()  : bool
Is the provided URL local to this instance?
listsEnabled()  : bool
Are lists enabled?
normalizeUrlForComparison()  : string
Normalize the referer URL so that inconsistencies in protocol and trailing slashes do not break comparisons.
output()  : Response
Send output data and exit.
parseSpecialFacetsSetting()  : array<string|int, mixed>
Parse the "special facets" setting.
processAdvancedCheckboxes()  : array<string|int, mixed>
Process the checkbox setting from special facets.
processJumpTo()  : bool|Response
Process the jumpto parameter -- either redirect to a specific record and return view model, or ignore the parameter and return false.
processJumpToOnlyResult()  : bool|Response
Process jump to record if there is only one result.
redirectToLegalSearchPage()  : mixed
If the search backend has thrown a "deep paging" exception, we should show a flash message and redirect the user to a legal page.
redirectToSavedSearch()  : mixed
Given a saved search ID, redirect the user to the appropriate place.
rememberSearch()  : void
Store the URL of the provided search (if appropriate).
restoreAdvancedSearch()  : bool|object
Either assign the requested search object to the view or display a flash message indicating why the operation failed.
resultScrollerActive()  : bool
Is the result scroller active?
retrieveSearchSecurely()  : SearchEntityInterface|null
Get a saved search, enforcing user ownership. Returns row if found, null otherwise.
sanitizeTranslationKey()  : string
Make sure there are not any illegal characters in the translation key that might prevent successful lookup in language files.
saveSearchToHistory()  : void
Save a search to the history in the database.
setFollowupUrlToReferer()  : void
Store a referer (if appropriate) to keep post-login redirect pointing to an appropriate location. This is used when the user clicks the log in link from an arbitrary page or when a password is mistyped; separate logic is used for storing followup information when VuFind forces the user to log in from another context.
tagsEnabled()  : bool
Are tags enabled?
translateString()  : string
Get translation for a string

Properties

$accessDeniedBehavior

Behavior when access is denied (used unless overridden through permissionBehavior.ini). Valid values are 'promptLogin' and 'exception'.

protected string $accessDeniedBehavior = null

Leave at null to use the defaultDeniedControllerBehavior set in permissionBehavior.ini (normally 'promptLogin' unless changed).

$accessPermission

Permission that must be granted to access this module (false for no restriction, null to use configured default (which is usually the same as false)).

protected string|bool|null $accessPermission = null

$defaultRecordFields

Default record fields to return if a request does not define the fields

protected array<string|int, mixed> $defaultRecordFields = []

$indexLabel

Descriptive label for the index managed by this controller

protected string $indexLabel = 'primary'

$jsonpCallback

Callback function in JSONP mode

protected string $jsonpCallback = null

$jsonPrettyPrint

Whether to pretty-print JSON

protected bool $jsonPrettyPrint = false

$maxLimit

Max limit of search results in API response (default 100);

protected int $maxLimit = 100

$modelPrefix

Prefix for use in model names used by API

protected string $modelPrefix = ''

$outputMode

Type of output to use

protected string $outputMode = 'json'

$recordAccessPermission

Permission required for the record endpoint

protected string $recordAccessPermission = 'access.api.Record'

$rememberSearch

Should we remember the search for breadcrumb purposes?

protected bool $rememberSearch = true

$saveToHistory

Should we save searches to history?

protected bool $saveToHistory = true

$searchAccessPermission

Permission required for the search endpoint

protected string $searchAccessPermission = 'access.api.Search'

$searchClassId

Search class family to use.

protected string $searchClassId = 'Solr'

$serviceLocator

Service manager

protected ServiceLocatorInterface $serviceLocator

Methods

advancedAction()

Handle an advanced search

public advancedAction() : ViewModel
Return values
ViewModel

confirm()

Confirm an action.

public confirm(string $title, string $yesTarget, string $noTarget[, string|array<string|int, mixed> $messages = [] ][, array<string|int, mixed> $extras = [] ]) : mixed
Parameters
$title : string

Title of confirm dialog

$yesTarget : string

Form target for "confirm" action

$noTarget : string

Form target for "cancel" action

$messages : string|array<string|int, mixed> = []

Info messages for confirm dialog

$extras : array<string|int, mixed> = []

Extra details to include in form

Return values
mixed

facetListAction()

Returns a list of all items associated with one facet for the lightbox

public facetListAction() : mixed

Parameters: facet The facet to retrieve searchParams Facet search params from $results->getUrlQuery()->getParams()

Return values
mixed

flashMessenger()

public flashMessenger() : FlashMessenger

FlashMessenger plugin

Return values
FlashMessenger

forceLogin()

Redirect the user to the login screen.

public forceLogin([string $msg = null ][, array<string|int, mixed> $extras = [] ][, bool $forward = true ]) : mixed
Parameters
$msg : string = null

Flash message to display on login screen

$extras : array<string|int, mixed> = []

Associative array of extra fields to store

$forward : bool = true

True to forward, false to redirect

Return values
mixed

forwardTo()

Convenience method to make invocation of forward() helper less verbose.

public forwardTo(string $controller, string $action[, array<string|int, mixed> $params = [] ]) : mixed
Parameters
$controller : string

Controller to invoke

$action : string

Action to invoke

$params : array<string|int, mixed> = []

Extra parameters for the RouteMatch object (no need to provide action here, since $action takes care of that)

Return values
mixed

getAccessPermission()

Getter for access permission (string for required permission name, false for no permission required, null to use default permission).

public getAccessPermission() : string|bool|null
Return values
string|bool|null

getApiSpecFragment()

Get API specification JSON fragment for services provided by the controller

public getApiSpecFragment() : string
Return values
string

getConfig()

Get a VuFind configuration.

public getConfig([string $id = 'config' ]) : Config
Parameters
$id : string = 'config'

Configuration identifier (default = main VuFind config)

Return values
Config

getDbService()

Get a database service object.

public getDbService(class-string<\VuFind\Controller\T> $name) : T
Parameters
$name : class-string<\VuFind\Controller\T>

Name of service to retrieve

Tags
template

T

Return values
T

getServerUrl()

Get the full URL to one of VuFind's routes.

public getServerUrl([bool|string $route = true ]) : string
Parameters
$route : bool|string = true

Boolean true for current URL, otherwise name of route to render as URL

Return values
string

getTable()

Get a database table object.

public getTable(string $table) : Gateway
Parameters
$table : string

Name of table to retrieve

Return values
Gateway

getTranslator()

Get translator object.

public getTranslator() : TranslatorInterface
Return values
TranslatorInterface

getTranslatorLocale()

Get the locale from the translator.

public getTranslatorLocale([string $default = 'en' ]) : string
Parameters
$default : string = 'en'

Default to use if translator absent.

Return values
string

homeAction()

Home action

public homeAction() : mixed
Return values
mixed

onDispatch()

Execute the request

public onDispatch(MvcEvent $e) : mixed
Parameters
$e : MvcEvent

Event

Tags
throws
DomainException|InvalidArgumentException|Exception
Return values
mixed

recordAction()

Record action

public recordAction() : Response
Return values
Response

resultsAction()

Send search results to results view

public resultsAction() : ResponseInterface|ViewModel
Return values
ResponseInterface|ViewModel

searchAction()

Search action

public searchAction() : Response
Return values
Response

setAccessPermission()

Getter for access permission.

public setAccessPermission(string|false $ap) : void
Parameters
$ap : string|false

Permission to require for access to the controller (false for no requirement)

Return values
void

translate()

Translate a string (or string-castable object)

public translate(string|object|array<string|int, mixed> $target[, array<string|int, mixed> $tokens = [] ][, string $default = null ][, bool $useIcuFormatter = false ][, array<string|int, string> $fallbackDomains = [] ]) : string
Parameters
$target : string|object|array<string|int, mixed>

String to translate or an array of text domain and string to translate

$tokens : array<string|int, mixed> = []

Tokens to inject into the translated string

$default : string = null

Default value to use if no translation is found (null for no default).

$useIcuFormatter : bool = false

Should we use an ICU message formatter instead of the default behavior?

$fallbackDomains : array<string|int, string> = []

Text domains to check if no match is found in the domain specified in $target

Return values
string

translateWithPrefix()

Translate a string (or string-castable object) using a prefix, or without the prefix if a prefixed translation is not found.

public translateWithPrefix(string $prefix, string|object|array<string|int, mixed> $target[, array<string|int, mixed> $tokens = [] ][, string $default = null ][, bool $useIcuFormatter = false ][, array<string|int, string> $fallbackDomains = [] ]) : string
Parameters
$prefix : string

Translation key prefix

$target : string|object|array<string|int, mixed>

String to translate or an array of text domain and string to translate

$tokens : array<string|int, mixed> = []

Tokens to inject into the translated string

$default : string = null

Default value to use if no translation is found (null for no default).

$useIcuFormatter : bool = false

Should we use an ICU message formatter instead of the default behavior?

$fallbackDomains : array<string|int, string> = []

Text domains to check if no match is found in the domain specified in $target

Return values
string

validateAccessPermission()

Use preDispatch event to block access when appropriate.

public validateAccessPermission(MvcEvent $e) : void
Parameters
$e : MvcEvent

Event object

Return values
void

attachDefaultListeners()

Register the default events for this controller

protected attachDefaultListeners() : void
Return values
void

catalogLogin()

Does the user have catalog credentials available? Returns associative array of patron data if so, otherwise forwards to appropriate login prompt and returns false. If there is an ILS exception, a flash message is added and a newly created ViewModel is returned.

protected catalogLogin() : bool|array<string|int, mixed>|ViewModel
Return values
bool|array<string|int, mixed>|ViewModel

clearFollowupUrl()

Sometimes we need to unset the followup to trigger default behaviors

protected clearFollowupUrl() : void
Return values
void

commentsEnabled()

Are comments enabled?

protected commentsEnabled() : bool
Return values
bool

createEmailViewModel()

Create a new ViewModel to use as an email form.

protected createEmailViewModel([array<string|int, mixed> $params = null ][, string $defaultSubject = null ]) : ViewModel
Parameters
$params : array<string|int, mixed> = null

Parameters to pass to ViewModel constructor.

$defaultSubject : string = null

Default subject line to use.

Return values
ViewModel

createViewModel()

Create a new ViewModel.

protected createViewModel([array<string|int, mixed> $params = null ]) : ViewModel
Parameters
$params : array<string|int, mixed> = null

Parameters to pass to ViewModel constructor.

Return values
ViewModel

determineOutputMode()

Determine the correct output mode based on content negotiation or the view parameter

protected determineOutputMode() : void
Return values
void

disableSessionWrites()

Prevent session writes -- this is designed to be called prior to time- consuming AJAX operations to help reduce the odds of a timing-related bug that causes the wrong version of session data to be written to disk (see VUFIND-716 for more details).

protected disableSessionWrites() : void
Return values
void

extractTextDomain()

Given a translation string with or without a text domain, return an array with the raw string and the text domain separated.

protected extractTextDomain(string|object|array<string|int, mixed> $target) : array<string|int, mixed>
Parameters
$target : string|object|array<string|int, mixed>

String to translate or an array of text domain and string to translate

Return values
array<string|int, mixed>

formWasSubmitted()

Check to see if a form was submitted from its post value Also validate the Captcha, if it's activated

protected formWasSubmitted([string|array<string|int, string>|null $submitElements = null ][, bool $useCaptcha = false ]) : bool
Parameters
$submitElements : string|array<string|int, string>|null = null

Name of the post field(s) to check to indicate a form submission (or null for default)

$useCaptcha : bool = false

Are we using captcha in this situation?

Return values
bool

getActiveRecommendationSettings()

Get active recommendation module settings

protected getActiveRecommendationSettings() : array<string|int, mixed>
Return values
array<string|int, mixed>

getAllRangeSettings()

Get all active range facets:

protected getAllRangeSettings(array<string|int, mixed> $specialFacets[, object $savedSearch = false ][, string $config = 'facets' ]) : array<string|int, mixed>
Parameters
$specialFacets : array<string|int, mixed>

Special facet setting (in parsed format)

$savedSearch : object = false

Saved search object (false if none)

$config : string = 'facets'

Name of config file

Return values
array<string|int, mixed>

getAndClearFollowupUrl()

Retrieve a referer to keep post-login redirect pointing to an appropriate location.

protected getAndClearFollowupUrl([bool $checkRedirect = false ]) : string

Unset the followup before returning.

Parameters
$checkRedirect : bool = false

Whether the query should be checked for param 'redirect'

Return values
string

getAuthorizationService()

Get the authorization service (note that we're doing this on-demand rather than through injection with the AuthorizationServiceAwareInterface to minimize expensive initialization when authorization is not needed.

protected getAuthorizationService() : AuthorizationService
Return values
AuthorizationService

getDateRangeSettings()

Get the current settings for the date range facets, if set:

protected getDateRangeSettings([object $savedSearch = false ][, string $config = 'facets' ][, array<string|int, mixed> $filter = [] ]) : array<string|int, mixed>
Parameters
$savedSearch : object = false

Saved search object (false if none)

$config : string = 'facets'

Name of config file

$filter : array<string|int, mixed> = []

List of fields to include (if empty, all fields will be returned)

Return values
array<string|int, mixed>

getDebugTranslation()

Build a debug-mode translation

protected getDebugTranslation(string $domain, string $str, array<string|int, mixed> $tokens) : string
Parameters
$domain : string

Text domain

$str : string

String to translate

$tokens : array<string|int, mixed>

Tokens to inject into the translated string

Return values
string

getFieldList()

Get field list based on the request

protected getFieldList(array<string|int, mixed> $request) : array<string|int, mixed>
Parameters
$request : array<string|int, mixed>

Request params

Return values
array<string|int, mixed>

getFullDateRangeSettings()

Get the current settings for the full date range facets, if set:

protected getFullDateRangeSettings([object $savedSearch = false ][, string $config = 'facets' ][, array<string|int, mixed> $filter = [] ]) : array<string|int, mixed>
Parameters
$savedSearch : object = false

Saved search object (false if none)

$config : string = 'facets'

Name of config file

$filter : array<string|int, mixed> = []

List of fields to include (if empty, all fields will be returned)

Return values
array<string|int, mixed>

getGenericRangeSettings()

Get the current settings for the generic range facets, if set:

protected getGenericRangeSettings([object $savedSearch = false ][, string $config = 'facets' ][, array<string|int, mixed> $filter = [] ]) : array<string|int, mixed>
Parameters
$savedSearch : object = false

Saved search object (false if none)

$config : string = 'facets'

Name of config file

$filter : array<string|int, mixed> = []

List of fields to include (if empty, all fields will be returned)

Return values
array<string|int, mixed>

getHierarchicalFacetData()

Get hierarchical facet data for the given facet fields

protected getHierarchicalFacetData(array<string|int, mixed> $facets) : array<string|int, mixed>
Parameters
$facets : array<string|int, mixed>

Facet fields

Return values
array<string|int, mixed>

getILSLoginMethod()

What login method does the ILS use (password, email, vufind)

protected getILSLoginMethod([string $target = '' ]) : string
Parameters
$target : string = ''

Login target (MultiILS only)

Return values
string

getILSLoginSettings()

Get settings required for displaying the catalog login form

protected getILSLoginSettings() : array<string|int, mixed>
Return values
array<string|int, mixed>

getNumericRangeSettings()

Get the current settings for the numeric range facets, if set:

protected getNumericRangeSettings([object $savedSearch = false ][, string $config = 'facets' ][, array<string|int, mixed> $filter = [] ]) : array<string|int, mixed>
Parameters
$savedSearch : object = false

Saved search object (false if none)

$config : string = 'facets'

Name of config file

$filter : array<string|int, mixed> = []

List of fields to include (if empty, all fields will be returned)

Return values
array<string|int, mixed>

getRangeFieldList()

Get the range facet configurations from the specified config section and filter them appropriately.

protected getRangeFieldList(string $config, string $section, array<string|int, mixed> $filter) : array<string|int, mixed>
Parameters
$config : string

Name of config file

$section : string

Configuration section to check

$filter : array<string|int, mixed>

List of fields to include (if empty, all fields will be returned)

Return values
array<string|int, mixed>

getRangeSettings()

Get the current settings for the specified range facet, if it is set:

protected getRangeSettings(array<string|int, mixed> $fields, string $type[, object $savedSearch = false ]) : array<string|int, mixed>
Parameters
$fields : array<string|int, mixed>

Fields to check

$type : string

Type of range to include in return value

$savedSearch : object = false

Saved search object (false if none)

Return values
array<string|int, mixed>

getRedirectForRecord()

Get a redirection response to a single record

protected getRedirectForRecord(AbstractBase $record[, array<string|int, mixed> $queryParams = [] ]) : Response
Parameters
$record : AbstractBase

Record driver

$queryParams : array<string|int, mixed> = []

Any query parameters

Return values
Response

getRefreshResponse()

Construct an HTTP 205 (refresh) response. Useful for reporting success in the lightbox without actually rendering content.

protected getRefreshResponse() : Response
Return values
Response

getRssSearchResponse()

Support method for getSearchResultsView() -- return the search results reformatted as an RSS feed.

protected getRssSearchResponse( $view) : ResponseInterface
Parameters
$view :

ViewModel View model

Return values
ResponseInterface

getSearchResultsView()

Perform a search and send results to a results view

protected getSearchResultsView([callable $setupCallback = null ]) : ResponseInterface|ViewModel
Parameters
$setupCallback : callable = null

Optional setup callback that overrides the default one

Return values
ResponseInterface|ViewModel

getSearchSetupCallback()

Get a callback for setting up a search (or null if callback is unnecessary).

protected getSearchSetupCallback() : mixed
Return values
mixed

getViewRenderer()

Get the view renderer

protected getViewRenderer() : RendererInterface
Return values
RendererInterface

hasFollowupUrl()

Checks if a followup url is set

protected hasFollowupUrl() : bool
Return values
bool

inLightbox()

Are we currently in a lightbox context?

protected inLightbox() : bool
Return values
bool

isAccessDenied()

Check whether access is denied and return the appropriate message or false.

protected isAccessDenied(string $permission) : Response|bool
Parameters
$permission : string

Permission to check

Return values
Response|bool

isLocalUrl()

Is the provided URL local to this instance?

protected isLocalUrl(string $url) : bool
Parameters
$url : string

URL to check

Return values
bool

listsEnabled()

Are lists enabled?

protected listsEnabled() : bool
Return values
bool

normalizeUrlForComparison()

Normalize the referer URL so that inconsistencies in protocol and trailing slashes do not break comparisons.

protected normalizeUrlForComparison(string $url) : string
Parameters
$url : string

URL to normalize

Return values
string

output()

Send output data and exit.

protected output(mixed $data, string $status[, int $httpCode = null ][, string $message = '' ]) : Response
Parameters
$data : mixed

The response data

$status : string

Status of the request

$httpCode : int = null

A custom HTTP Status Code

$message : string = ''

Status message

Tags
throws
Exception
Return values
Response

parseSpecialFacetsSetting()

Parse the "special facets" setting.

protected parseSpecialFacetsSetting(string $specialFacets) : array<string|int, mixed>
Parameters
$specialFacets : string

Unparsed string

Return values
array<string|int, mixed>

processAdvancedCheckboxes()

Process the checkbox setting from special facets.

protected processAdvancedCheckboxes(array<string|int, mixed> $params[, object $savedSearch = false ]) : array<string|int, mixed>
Parameters
$params : array<string|int, mixed>

Parameters to the checkbox setting

$savedSearch : object = false

Saved search object (false if none)

Return values
array<string|int, mixed>

processJumpTo()

Process the jumpto parameter -- either redirect to a specific record and return view model, or ignore the parameter and return false.

protected processJumpTo(Results $results) : bool|Response
Parameters
$results : Results

Search results object.

Return values
bool|Response

processJumpToOnlyResult()

Process jump to record if there is only one result.

protected processJumpToOnlyResult(Results $results) : bool|Response
Parameters
$results : Results

Search results object.

Return values
bool|Response

redirectToLegalSearchPage()

If the search backend has thrown a "deep paging" exception, we should show a flash message and redirect the user to a legal page.

protected redirectToLegalSearchPage(array<string|int, mixed> $request, int $page) : mixed
Parameters
$request : array<string|int, mixed>

Incoming request parameters

$page : int

Legal page number

Return values
mixed

redirectToSavedSearch()

Given a saved search ID, redirect the user to the appropriate place.

protected redirectToSavedSearch(int $id) : mixed
Parameters
$id : int

ID from search history

Return values
mixed

rememberSearch()

Store the URL of the provided search (if appropriate).

protected rememberSearch(Results $results) : void
Parameters
$results : Results

Search results object

Return values
void

restoreAdvancedSearch()

Either assign the requested search object to the view or display a flash message indicating why the operation failed.

protected restoreAdvancedSearch(string $searchId) : bool|object
Parameters
$searchId : string

ID value of a saved advanced search.

Return values
bool|object

Restored search object if found, false otherwise.

resultScrollerActive()

Is the result scroller active?

protected resultScrollerActive() : bool
Return values
bool

retrieveSearchSecurely()

Get a saved search, enforcing user ownership. Returns row if found, null otherwise.

protected retrieveSearchSecurely(int $searchId) : SearchEntityInterface|null
Parameters
$searchId : int

Primary key value

Return values
SearchEntityInterface|null

sanitizeTranslationKey()

Make sure there are not any illegal characters in the translation key that might prevent successful lookup in language files.

protected sanitizeTranslationKey(string $key) : string
Parameters
$key : string

Key to sanitize

Return values
string

Sanitized key

saveSearchToHistory()

Save a search to the history in the database.

protected saveSearchToHistory(Results $results) : void
Parameters
$results : Results

Search results

Return values
void

setFollowupUrlToReferer()

Store a referer (if appropriate) to keep post-login redirect pointing to an appropriate location. This is used when the user clicks the log in link from an arbitrary page or when a password is mistyped; separate logic is used for storing followup information when VuFind forces the user to log in from another context.

protected setFollowupUrlToReferer([bool $allowCurrentUrl = true ][, array<string|int, mixed> $extras = [] ]) : void
Parameters
$allowCurrentUrl : bool = true

Whether the current URL is valid for followup

$extras : array<string|int, mixed> = []

Extra data for the followup

Return values
void

tagsEnabled()

Are tags enabled?

protected tagsEnabled() : bool
Return values
bool

translateString()

Get translation for a string

protected translateString(string $rawStr[, array<string|int, mixed> $tokens = [] ][, string $default = null ][, string $domain = 'default' ][, bool $useIcuFormatter = false ]) : string
Parameters
$rawStr : string

String to translate

$tokens : array<string|int, mixed> = []

Tokens to inject into the translated string

$default : string = null

Default value to use if no translation is found (null for no default).

$domain : string = 'default'

Text domain (omit for default)

$useIcuFormatter : bool = false

Should we use an ICU message formatter instead of the default behavior?

Return values
string

Search results