VuFind API Documentation

Params extends Params
in package

Solr Collection Search Options

Tags
category

VuFind

author

Demian Katz demian.katz@villanova.edu

license

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

link

Main Site

Table of Contents

$checkboxFacets  : array<string|int, mixed>
Checkbox facet configuration
$collectionField  : string
The field which defines something as being a collection this is usually either hierarchy_parent_id or hierarchy_top_id
$collectionID  : string
The ID of the collection being searched
$configLoader  : PluginManager
Config loader
$defaultFacetLabelCheckboxSections  : array<string|int, mixed>
Config sections to search for checkbox facet labels if no override configuration is set.
$defaultFacetLabelSections  : array<string|int, mixed>
Config sections to search for facet labels if no override configuration is set.
$defaultsApplied  : bool
Are default filters applied?
$extraFacetLabels  : array<string|int, mixed>
Extra facet labels
$facetAliases  : array<string|int, mixed>
Map of facet field aliases.
$facetConfig  : array<string|int, mixed>
Main facet configuration
$facetContains  : string
Search with facet.contains cf. https://lucene.apache.org/solr/guide/7_3/faceting.html
$facetContainsIgnoreCase  : bool
Ignore Case when using facet.contains cf. https://lucene.apache.org/solr/guide/7_3/faceting.html
$facetHelper  : HierarchicalFacetHelper
Hierarchical Facet Helper
$facetLimit  : int
Default facet result limit
$facetLimitByField  : array<string|int, mixed>
Per-field facet result limit
$facetMatchesByField  : array<string|int, mixed>
Per-field facet matches
$facetOffset  : int
Offset for facet results
$facetPrefix  : string
Prefix for facet searching
$facetPrefixByField  : array<string|int, mixed>
Per-field facet prefix
$facetSort  : string
Sorting order for facet search results
$filterList  : array<string|int, mixed>
Applied filters
$hiddenFilters  : array<string|int, mixed>
Pre-assigned filters
$hierarchicalFacetLimit  : int
Hierarchical facet limit when facets are requested.
$indexSortedFacets  : array<string|int, mixed>
Sorting order of single facet by index
$lastView  : string
Previously-used view (loaded in from session)
$limit  : int
Result limit
$options  : Options
Search options
$orFacets  : array<string|int, mixed>
Facets in "OR" mode
$overrideQuery  : mixed
Override Query
$page  : int
Page number
$pivotFacets  : string
Fields for visual faceting
$query  : Query
Internal representation of user query.
$queryAdapter  : QueryAdapterInterface|null
Query adapter
$queryAdapterClass  : string
Default query adapter class
$searchContextParameters  : array<string|int, mixed>
Search context parameters.
$searchingById  : bool
Are we searching by ID only (instead of a normal query)?
$searchType  : string
Search type (basic or advanced)
$selectedShards  : array<string|int, mixed>
Shards
$skipRssSort  : bool
Override special RSS sort feature?
$sort  : string
Sort setting
$view  : string
View
__clone()  : void
Copy constructor
__construct()  : mixed
Constructor
addCheckboxFacet()  : void
Add a checkbox facet. When the checkbox is checked, the specified filter will be applied to the search. When the checkbox is not checked, no filter will be applied.
addFacet()  : void
Add a field to facet on.
addFilter()  : void
Take a filter string and add it into the protected array checking for duplicates.
addHiddenFilter()  : void
Take a filter string and add it into the protected hidden filters array checking for duplicates.
addHiddenFilterForField()  : void
Take a filter string and add it into the protected hidden filters array checking for duplicates.
convertToAdvancedSearch()  : void
Convert a basic query into an advanced query:
deminify()  : void
Restore settings from a minified object found in the database.
getAliasesForFacetField()  : array<string|int, mixed>
Given a facet field, return an array containing all aliases of that field.
getBackendParameters()  : ParamBag
Create search backend parameters for advanced features.
getCheckboxFacets()  : array<string|int, mixed>
Get information on the current state of the boolean checkbox facets.
getCollectionField()  : string
Get collection field
getCollectionId()  : string
Get collection id
getDefaultSort()  : string
Return the default sorting value
getDisplayQuery()  : string
Build a string for onscreen display showing the query used in the search (not the filters).
getDisplayQueryWithReplacedTerm()  : string
Return a query string for the current search with a search term replaced.
getFacetConfig()  : array<string|int, mixed>
Get the current facet configuration.
getFacetLabel()  : string
Get a user-friendly string to describe the provided facet field.
getFacetOperator()  : string
Get facet operator for the specified field
getFacetSettings()  : array<string|int, mixed>
Return current facet configurations
getFacetValueRawDisplayText()  : string
Get a display text for a facet field.
getFilterList()  : array<string|int, mixed>
Return an array structure containing information about all current filters.
getFiltersAsQueryParams()  : array<string|int, mixed>
Get the filter list as a query parameter array.
getFilterSettings()  : array<string|int, mixed>
Return the current filters as an array of strings ['field:filter']
getHiddenFilters()  : array<string|int, mixed>
Get hidden filters grouped by field like normal filters.
getHiddenFiltersAsQueryParams()  : array<string|int, mixed>
Get the hidden filter list as a query parameter array.
getHierarchicalFacetLimit()  : int
Get current limit for hierarchical facets
getLimit()  : int
Return the current limit value
getLimitList()  : array<string|int, mixed>
Return a list of urls for possible limits, along with which option should be currently selected.
getOptions()  : Options
Get the search options object.
getOverrideQuery()  : string
Get the override query
getPage()  : int
Get the page value
getPivotFacets()  : string
Get pivot facet information for visual facets
getQuery()  : AbstractQuery
Return search query object.
getQueryAdapter()  : QueryAdapterInterface
Get query adapter
getQueryIDLimit()  : int
Get the maximum number of IDs that may be sent to setQueryIDs (-1 for no limit).
getRawFilters()  : array<string|int, mixed>
Get the raw filter list.
getSavedSearchContextParameters()  : array<string|int, mixed>
Get remembered search context parameters from saved search. We track these separately since in some contexts we want to use them (e.g. linking back to a search in breadcrumbs), but in other contexts we want to ignore them (e.g. comparing two searches to see if they represent the same query -- because page 1 and page 2 still represent the same overall search).
getSearchClassId()  : string
Get the identifier used for naming the various search classes in this family.
getSearchHandler()  : string|null
Return the selected search handler (null for complex searches which have no single handler)
getSearchType()  : string
Return the search type (i.e. basic or advanced)
getSelectedShards()  : array<string|int, mixed>
Get an array of the names of all selected shards. These should correspond with keys in the array returned by the option class's getShards() method.
getSort()  : string
Return the sorting value
getSortList()  : array<string|int, mixed>
Return a list of urls for sorting, along with which option should be currently selected.
getView()  : string
Return the value for which search view we use
getViewList()  : array<string|int, mixed>
Basic 'getter' for list of available view options.
hasDefaultsApplied()  : bool
Are default filters applied?
hasFilter()  : bool
Does the object already contain the specified filter?
hasHiddenFilter()  : bool
Does the object already contain the specified hidden filter?
initAdvancedFacets()  : void
Initialize facet settings for the advanced search screen.
initFromRecordDriver()  : void
Pull the search parameters from the query and set up additional options using a record driver representing a collection.
initFromRequest()  : void
Pull the search parameters
initHomePageFacets()  : void
Initialize facet settings for the home page.
initNewItemsFacets()  : void
Initialize facet settings for the new items page.
isAdvancedFilter()  : bool
Detects if a filter is advanced (true) or simple (false). An advanced filter is currently defined as one surrounded by parentheses (possibly with a leading exclusion operator), while a simple filter is of the form field:value. Advanced filters are used to express more complex queries, such as combining multiple values from multiple fields using boolean operators.
minify()  : void
Store settings to a minified object
parseFilter()  : array<string|int, mixed>
Parse apart the field and value from a URL filter string.
parseFilterAndPrefix()  : array<string|int, mixed>
Parse apart any prefix, field and value from a URL filter string.
removeAllFilters()  : void
Remove all filters from the list.
removeFilter()  : void
Remove a filter from the list.
resetFacetConfig()  : void
Reset the current facet configuration.
setBasicSearch()  : void
Set a basic search query:
setFacetContains()  : void
Set Facet Contains
setFacetContainsIgnoreCase()  : void
Set Facet Contains Ignore Case
setFacetLimit()  : void
Set Facet Limit
setFacetLimitByField()  : void
Set Facet Limit by Field
setFacetMatchesByField()  : void
Set Facet Matches by Field
setFacetOffset()  : void
Set Facet Offset
setFacetPrefix()  : void
Set Facet Prefix
setFacetPrefixByField()  : void
Set Facet Prefix by Field
setFacetSort()  : void
Set Facet Sorting
setHierarchicalFacetLimit()  : void
Set limit for hierarchical facets
setIndexSortedFacets()  : void
Set Index Facet Sorting
setLastView()  : void
Set the last value of the view parameter (if available in session).
setLimit()  : void
Change the value of the limit
setOptions()  : void
Set the search options object.
setOverrideQuery()  : void
Set the override query
setPage()  : void
Change the page
setPivotFacets()  : void
Set pivot facet fields to use for visual results
setQuery()  : void
Set search query object.
setQueryAdapter()  : void
Set query adapter
setQueryIDs()  : void
Override the normal search behavior with an explicit array of IDs that must be retrieved.
setSort()  : void
Set the sorting value (note: sort will be set to default if an illegal or empty value is passed in).
setView()  : void
Set the value for which search view we use
supportsFacetFiltering()  : bool
Check whether a specific facet supports filtering
translate()  : string
Translate a string (or string-castable object)
translateFacetValue()  : string
Translate a facet value.
buildDateRangeFilter()  : string
Support method for initDateFilters() -- build a filter query based on a range of 4-digit years.
buildFullDateRangeFilter()  : string
Support method for initFullDateFilters() -- build a filter query based on a range of dates.
buildGenericRangeFilter()  : string
Support method for initGenericRangeFilters() -- build a filter query based on a range of values.
buildNumericRangeFilter()  : string
Support method for initNumericRangeFilters() -- build a filter query based on a range of numbers.
formatDateForFullDateRange()  : string
Support method for initFullDateFilters() -- normalize a date for use in a year/month/day date range.
formatFilterArrayAsQueryParams()  : array<string|int, mixed>
Format a raw filter array as a query parameter array.
formatFilterListEntry()  : array<string|int, mixed>
Format a single filter for use in getFilterList().
formatValueForNumericRange()  : string
Support method for initNumericRangeFilters() -- normalize a year for use in a date range.
formatYearForDateRange()  : string
Support method for initDateFilters() -- normalize a year for use in a year-based date range.
getCheckboxFacetValues()  : array<string|int, mixed>
Get a formatted list of checkbox filter values ($field => array of values).
getFacetLimitForField()  : int
Get the facet limit for the specified field.
getFacetMatchesForField()  : string
Get the facet matches for the specified field.
getFacetPrefixForField()  : string
Get the facet prefix for the specified field.
getRawCheckboxFacets()  : array<string|int, mixed>
Return checkbox facets without any processing
initAdvancedSearch()  : void
Support method for initSearch() -- handle advanced settings. Advanced searches have numeric subscripts on the lookfor and type parameters -- this is how they are distinguished from basic searches.
initBasicSearch()  : bool
Support method for initSearch() -- handle basic settings.
initCheckboxFacets()  : bool
Initialize checkbox facet settings for the specified configuration sections.
initDateFilters()  : void
Support method for initFilters() -- initialize year-based date filters.
initFacetLimitsFromConfig()  : void
Initialize facet limit from a Config object.
initFacetList()  : bool
Initialize facet settings for the specified configuration sections.
initFacetRestrictionsFromConfig()  : void
Initialize facet prefix and matches from a Config object.
initFilters()  : void
Add filters to the object based on values found in the request object.
initFullDateFilters()  : void
Support method for initFilters() -- initialize year/month/day-based date filters. Factored out as a separate method so that it can be more easily overridden by child classes.
initGenericRangeFilters()  : void
Support method for initFilters() -- initialize range filters. Factored out as a separate method so that it can be more easily overridden by child classes.
initHiddenFilters()  : void
Add hidden filters to the object based on values found in the request object.
initLimit()  : void
Pull the page size parameter or set to default
initNumericRangeFilters()  : void
Support method for initFilters() -- initialize numeric range filters. Factored out as a separate method so that it can be more easily overridden by child classes.
initPage()  : void
Pull the page parameter
initRangeFilters()  : void
Initialize all range filters.
initSearch()  : void
Initialize the object's search settings from a request object.
initShards()  : void
Pull shard parameters from the request or set defaults
initSort()  : void
Get the value for which type of sorting to use
initView()  : void
Get the value for which results view to use
normalizeSort()  : string
Normalize sort parameters.
parseOperatorAndFieldName()  : array<string|int, mixed>
Parse the operator and field name from a prefixed field string.

Properties

$checkboxFacets

Checkbox facet configuration

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

$collectionField

The field which defines something as being a collection this is usually either hierarchy_parent_id or hierarchy_top_id

protected string $collectionField = null

$collectionID

The ID of the collection being searched

protected string $collectionID = null

$defaultFacetLabelCheckboxSections

Config sections to search for checkbox facet labels if no override configuration is set.

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

$defaultFacetLabelSections

Config sections to search for facet labels if no override configuration is set.

protected array<string|int, mixed> $defaultFacetLabelSections = ['ExtraFacetLabels']

$defaultsApplied

Are default filters applied?

protected bool $defaultsApplied = false

$extraFacetLabels

Extra facet labels

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

$facetAliases

Map of facet field aliases.

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

$facetConfig

Main facet configuration

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

$facetContains

Search with facet.contains cf. https://lucene.apache.org/solr/guide/7_3/faceting.html

protected string $facetContains = null

$facetContainsIgnoreCase

Ignore Case when using facet.contains cf. https://lucene.apache.org/solr/guide/7_3/faceting.html

protected bool $facetContainsIgnoreCase = null

$facetLimit

Default facet result limit

protected int $facetLimit = 30

$facetLimitByField

Per-field facet result limit

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

$facetMatchesByField

Per-field facet matches

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

$facetOffset

Offset for facet results

protected int $facetOffset = null

$facetPrefix

Prefix for facet searching

protected string $facetPrefix = null

$facetPrefixByField

Per-field facet prefix

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

$facetSort

Sorting order for facet search results

protected string $facetSort = null

$filterList

Applied filters

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

$hiddenFilters

Pre-assigned filters

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

$hierarchicalFacetLimit

Hierarchical facet limit when facets are requested.

protected int $hierarchicalFacetLimit = -1

-1 = unlimited

$indexSortedFacets

Sorting order of single facet by index

protected array<string|int, mixed> $indexSortedFacets = null

$lastView

Previously-used view (loaded in from session)

protected string $lastView = null

$limit

Result limit

protected int $limit = 20

$orFacets

Facets in "OR" mode

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

$overrideQuery

Override Query

protected mixed $overrideQuery = false

$page

Page number

protected int $page = 1

$pivotFacets

Fields for visual faceting

protected string $pivotFacets = null

$query

Internal representation of user query.

protected Query $query

$queryAdapterClass

Default query adapter class

protected string $queryAdapterClass = \VuFind\Search\QueryAdapter::class

$searchContextParameters

Search context parameters.

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

$searchingById

Are we searching by ID only (instead of a normal query)?

protected bool $searchingById = false

$searchType

Search type (basic or advanced)

protected string $searchType = 'basic'

$selectedShards

Shards

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

$skipRssSort

Override special RSS sort feature?

protected bool $skipRssSort = false

$sort

Sort setting

protected string $sort = null

$view

View

protected string $view = null

Methods

__clone()

Copy constructor

public __clone() : void
Return values
void

addCheckboxFacet()

Add a checkbox facet. When the checkbox is checked, the specified filter will be applied to the search. When the checkbox is not checked, no filter will be applied.

public addCheckboxFacet(string $filter, string $desc[, bool $dynamic = false ]) : void
Parameters
$filter : string

[field]:[value] pair to associate with checkbox

$desc : string

Description to associate with the checkbox

$dynamic : bool = false

Is this being added dynamically (true) or in response to a user configuration (false)?

Return values
void

addFacet()

Add a field to facet on.

public addFacet(string $newField[, string $newAlias = null ][, bool $ored = false ]) : void
Parameters
$newField : string

Field name

$newAlias : string = null

Optional on-screen display label

$ored : bool = false

Should we treat this as an ORed facet?

Return values
void

addFilter()

Take a filter string and add it into the protected array checking for duplicates.

public addFilter(string $newFilter) : void
Parameters
$newFilter : string

A filter string from url : "field:value"

Return values
void

addHiddenFilter()

Take a filter string and add it into the protected hidden filters array checking for duplicates.

public addHiddenFilter(string $newFilter) : void
Parameters
$newFilter : string

A filter string from url : "field:value"

Return values
void

addHiddenFilterForField()

Take a filter string and add it into the protected hidden filters array checking for duplicates.

public addHiddenFilterForField(string $field, string $value) : void
Parameters
$field : string

Field

$value : string

Filter value

Return values
void

convertToAdvancedSearch()

Convert a basic query into an advanced query:

public convertToAdvancedSearch() : void
Return values
void

deminify()

Restore settings from a minified object found in the database.

public deminify(Minified $minified) : void
Parameters
$minified : Minified

Minified Search Object

Return values
void

getAliasesForFacetField()

Given a facet field, return an array containing all aliases of that field.

public getAliasesForFacetField(string $field) : array<string|int, mixed>
Parameters
$field : string

Field to look up

Return values
array<string|int, mixed>

getBackendParameters()

Create search backend parameters for advanced features.

public getBackendParameters() : ParamBag
Return values
ParamBag

getCheckboxFacets()

Get information on the current state of the boolean checkbox facets.

public getCheckboxFacets([array<string|int, mixed> $include = null ][, bool $includeDynamic = true ]) : array<string|int, mixed>
Parameters
$include : array<string|int, mixed> = null

List of checkbox filters to return (null for all)

$includeDynamic : bool = true

Should we include dynamically-generated checkboxes that are not part of the include list above?

Return values
array<string|int, mixed>

getCollectionField()

Get collection field

public getCollectionField() : string
Return values
string

getCollectionId()

Get collection id

public getCollectionId() : string
Return values
string

getDefaultSort()

Return the default sorting value

public getDefaultSort() : string
Return values
string

getDisplayQuery()

Build a string for onscreen display showing the query used in the search (not the filters).

public getDisplayQuery() : string
Return values
string

user friendly version of 'query'

getDisplayQueryWithReplacedTerm()

Return a query string for the current search with a search term replaced.

public getDisplayQueryWithReplacedTerm(string $oldTerm, string $newTerm) : string
Parameters
$oldTerm : string

The old term to replace

$newTerm : string

The new term to search

Return values
string

query string

getFacetConfig()

Get the current facet configuration.

public getFacetConfig() : array<string|int, mixed>
Return values
array<string|int, mixed>

getFacetLabel()

Get a user-friendly string to describe the provided facet field.

public getFacetLabel(string $field[, string $value = null ][, string $default = null ]) : string
Parameters
$field : string

Facet field name.

$value : string = null

Facet value.

$default : string = null

Default field name (null for default behavior).

Return values
string

Human-readable description of field.

getFacetOperator()

Get facet operator for the specified field

public getFacetOperator(string $field) : string
Parameters
$field : string

Field name

Return values
string

getFacetSettings()

Return current facet configurations

public getFacetSettings() : array<string|int, mixed>
Return values
array<string|int, mixed>

$facetSet

getFacetValueRawDisplayText()

Get a display text for a facet field.

public getFacetValueRawDisplayText(string $field, string $value) : string
Parameters
$field : string

Facet field

$value : string

Facet value

Return values
string

getFilterList()

Return an array structure containing information about all current filters.

public getFilterList([bool $excludeCheckboxFilters = false ]) : array<string|int, mixed>
Parameters
$excludeCheckboxFilters : bool = false

Should we exclude checkbox filters from the list (to be used as a complement to getCheckboxFacets()).

Return values
array<string|int, mixed>

Field, values and translation status

getFiltersAsQueryParams()

Get the filter list as a query parameter array.

public getFiltersAsQueryParams() : array<string|int, mixed>

Returns an array of strings that parseFilter can parse.

Return values
array<string|int, mixed>

getFilterSettings()

Return the current filters as an array of strings ['field:filter']

public getFilterSettings() : array<string|int, mixed>
Return values
array<string|int, mixed>

$filterQuery

getHiddenFilters()

Get hidden filters grouped by field like normal filters.

public getHiddenFilters() : array<string|int, mixed>
Return values
array<string|int, mixed>

getHiddenFiltersAsQueryParams()

Get the hidden filter list as a query parameter array.

public getHiddenFiltersAsQueryParams() : array<string|int, mixed>

Returns an array of strings that parseFilter can parse.

Return values
array<string|int, mixed>

getHierarchicalFacetLimit()

Get current limit for hierarchical facets

public getHierarchicalFacetLimit() : int
Return values
int

getLimit()

Return the current limit value

public getLimit() : int
Return values
int

getLimitList()

Return a list of urls for possible limits, along with which option should be currently selected.

public getLimitList() : array<string|int, mixed>
Return values
array<string|int, mixed>

Limit urls, descriptions and selected flags

getOverrideQuery()

Get the override query

public getOverrideQuery() : string
Return values
string

getPage()

Get the page value

public getPage() : int
Return values
int

getPivotFacets()

Get pivot facet information for visual facets

public getPivotFacets() : string
Return values
string

getQueryIDLimit()

Get the maximum number of IDs that may be sent to setQueryIDs (-1 for no limit).

public getQueryIDLimit() : int
Return values
int

getRawFilters()

Get the raw filter list.

public getRawFilters() : array<string|int, mixed>
Return values
array<string|int, mixed>

getSavedSearchContextParameters()

Get remembered search context parameters from saved search. We track these separately since in some contexts we want to use them (e.g. linking back to a search in breadcrumbs), but in other contexts we want to ignore them (e.g. comparing two searches to see if they represent the same query -- because page 1 and page 2 still represent the same overall search).

public getSavedSearchContextParameters() : array<string|int, mixed>
Return values
array<string|int, mixed>

getSearchClassId()

Get the identifier used for naming the various search classes in this family.

public getSearchClassId() : string
Return values
string

getSearchHandler()

Return the selected search handler (null for complex searches which have no single handler)

public getSearchHandler() : string|null
Return values
string|null

getSearchType()

Return the search type (i.e. basic or advanced)

public getSearchType() : string
Return values
string

getSelectedShards()

Get an array of the names of all selected shards. These should correspond with keys in the array returned by the option class's getShards() method.

public getSelectedShards() : array<string|int, mixed>
Return values
array<string|int, mixed>

getSort()

Return the sorting value

public getSort() : string
Return values
string

getSortList()

Return a list of urls for sorting, along with which option should be currently selected.

public getSortList() : array<string|int, mixed>
Return values
array<string|int, mixed>

Sort urls, descriptions and selected flags

getView()

Return the value for which search view we use

public getView() : string
Return values
string

getViewList()

Basic 'getter' for list of available view options.

public getViewList() : array<string|int, mixed>
Return values
array<string|int, mixed>

hasDefaultsApplied()

Are default filters applied?

public hasDefaultsApplied() : bool
Return values
bool

hasFilter()

Does the object already contain the specified filter?

public hasFilter(string $filter) : bool
Parameters
$filter : string

A filter string from url : "field:value"

Return values
bool

hasHiddenFilter()

Does the object already contain the specified hidden filter?

public hasHiddenFilter(string $filter) : bool
Parameters
$filter : string

A filter string from url : "field:value"

Return values
bool

initAdvancedFacets()

Initialize facet settings for the advanced search screen.

public initAdvancedFacets() : void
Return values
void

initFromRecordDriver()

Pull the search parameters from the query and set up additional options using a record driver representing a collection.

public initFromRecordDriver(AbstractBase $driver[, bool $hasSearch = false ]) : void
Parameters
$driver : AbstractBase

Record driver

$hasSearch : bool = false

Is the user performing a search?

Return values
void

initFromRequest()

Pull the search parameters

public initFromRequest(Parameters $request) : void
Parameters
$request : Parameters

Parameter object representing user request.

Return values
void

initHomePageFacets()

Initialize facet settings for the home page.

public initHomePageFacets() : void
Return values
void

initNewItemsFacets()

Initialize facet settings for the new items page.

public initNewItemsFacets() : void
Return values
void

isAdvancedFilter()

Detects if a filter is advanced (true) or simple (false). An advanced filter is currently defined as one surrounded by parentheses (possibly with a leading exclusion operator), while a simple filter is of the form field:value. Advanced filters are used to express more complex queries, such as combining multiple values from multiple fields using boolean operators.

public isAdvancedFilter(string $filter) : bool
Parameters
$filter : string

A filter string

Return values
bool

minify()

Store settings to a minified object

public minify(Minified &$minified) : void
Parameters
$minified : Minified

Minified Search Object

Return values
void

parseFilter()

Parse apart the field and value from a URL filter string.

public parseFilter(string $filter) : array<string|int, mixed>
Parameters
$filter : string

A filter string from url : "field:value"

Return values
array<string|int, mixed>

Array with elements 0 = field, 1 = value.

parseFilterAndPrefix()

Parse apart any prefix, field and value from a URL filter string.

public parseFilterAndPrefix(string $filter) : array<string|int, mixed>
Parameters
$filter : string

A filter string from url : "field:value"

Return values
array<string|int, mixed>

Array with elements 0 = prefix, 1 = field, 2 = value.

removeAllFilters()

Remove all filters from the list.

public removeAllFilters([string $field = null ]) : void
Parameters
$field : string = null

Name of field to remove filters from (null to remove all filters from all fields)

Return values
void

removeFilter()

Remove a filter from the list.

public removeFilter(string $oldFilter) : void
Parameters
$oldFilter : string

A filter string from url : "field:value"

Return values
void

resetFacetConfig()

Reset the current facet configuration.

public resetFacetConfig() : void
Return values
void

setBasicSearch()

Set a basic search query:

public setBasicSearch(string $lookfor[, string $handler = null ]) : void
Parameters
$lookfor : string

The search query

$handler : string = null

The search handler (null for default)

Return values
void

setFacetContains()

Set Facet Contains

public setFacetContains(string $p) : void
Parameters
$p : string

the new contains value

Return values
void

setFacetContainsIgnoreCase()

Set Facet Contains Ignore Case

public setFacetContainsIgnoreCase(bool $val) : void
Parameters
$val : bool

the new boolean value

Return values
void

setFacetLimit()

Set Facet Limit

public setFacetLimit(int $l) : void
Parameters
$l : int

the new limit value

Return values
void

setFacetLimitByField()

Set Facet Limit by Field

public setFacetLimitByField(array<string|int, mixed> $new) : void
Parameters
$new : array<string|int, mixed>

Associative array of $field name => $limit

Return values
void

setFacetMatchesByField()

Set Facet Matches by Field

public setFacetMatchesByField(array<string|int, mixed> $new) : void
Parameters
$new : array<string|int, mixed>

Associative array of $field name => $limit

Return values
void

setFacetOffset()

Set Facet Offset

public setFacetOffset(int $o) : void
Parameters
$o : int

the new offset value

Return values
void

setFacetPrefix()

Set Facet Prefix

public setFacetPrefix(string $p) : void
Parameters
$p : string

the new prefix value

Return values
void

setFacetPrefixByField()

Set Facet Prefix by Field

public setFacetPrefixByField(array<string|int, mixed> $new) : void
Parameters
$new : array<string|int, mixed>

Associative array of $field name => $limit

Return values
void

setFacetSort()

Set Facet Sorting

public setFacetSort(string $s) : void
Parameters
$s : string

the new sorting action value

Return values
void

setHierarchicalFacetLimit()

Set limit for hierarchical facets

public setHierarchicalFacetLimit(int $limit) : void
Parameters
$limit : int

New limit

Return values
void

setIndexSortedFacets()

Set Index Facet Sorting

public setIndexSortedFacets(array<string|int, mixed> $s) : void
Parameters
$s : array<string|int, mixed>

the facets sorted by index

Return values
void

setLastView()

Set the last value of the view parameter (if available in session).

public setLastView(string $view) : void
Parameters
$view : string

Last valid view parameter value

Return values
void

setLimit()

Change the value of the limit

public setLimit(int $l) : void
Parameters
$l : int

New limit value.

Return values
void

setOptions()

Set the search options object.

public setOptions(Options $options) : void
Parameters
$options : Options

Options to use

Return values
void

setOverrideQuery()

Set the override query

public setOverrideQuery(string $q) : void
Parameters
$q : string

Override query

Return values
void

setPage()

Change the page

public setPage(int $p) : void
Parameters
$p : int

New page value.

Return values
void

setPivotFacets()

Set pivot facet fields to use for visual results

public setPivotFacets(string $facets) : void
Parameters
$facets : string

A comma-separated list of fields

Return values
void

setQueryIDs()

Override the normal search behavior with an explicit array of IDs that must be retrieved.

public setQueryIDs(array<string|int, mixed> $ids) : void
Parameters
$ids : array<string|int, mixed>

Record IDs to load

Tags
SuppressWarnings

(PHPMD.UnusedFormalParameter)

Return values
void

setSort()

Set the sorting value (note: sort will be set to default if an illegal or empty value is passed in).

public setSort(string $sort[, bool $force = false ]) : void
Parameters
$sort : string

New sort value (null for default)

$force : bool = false

Set sort value without validating it?

Return values
void

setView()

Set the value for which search view we use

public setView(string $v) : void
Parameters
$v : string

New view setting

Return values
void

supportsFacetFiltering()

Check whether a specific facet supports filtering

public supportsFacetFiltering(string $facet) : bool
Parameters
$facet : string

The facet to check

Return values
bool

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 ]) : 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).

Return values
string

translateFacetValue()

Translate a facet value.

public translateFacetValue(string $field, string|TranslatableString $text) : string
Parameters
$field : string

Field name

$text : string|TranslatableString

Field value (processed by getFacetValueRawDisplayText)

Return values
string

buildDateRangeFilter()

Support method for initDateFilters() -- build a filter query based on a range of 4-digit years.

protected buildDateRangeFilter(string $field, string $from, string $to) : string
Parameters
$field : string

field to use for filtering.

$from : string

year for start of range.

$to : string

year for end of range.

Return values
string

filter query.

buildFullDateRangeFilter()

Support method for initFullDateFilters() -- build a filter query based on a range of dates.

protected buildFullDateRangeFilter(string $field, string $from, string $to) : string
Parameters
$field : string

field to use for filtering.

$from : string

year for start of range.

$to : string

year for end of range.

Return values
string

filter query.

buildGenericRangeFilter()

Support method for initGenericRangeFilters() -- build a filter query based on a range of values.

protected buildGenericRangeFilter(string $field, string $from, string $to[, bool $cs = true ]) : string
Parameters
$field : string

field to use for filtering.

$from : string

start of range.

$to : string

end of range.

$cs : bool = true

Should ranges be case-sensitive?

Return values
string

filter query.

buildNumericRangeFilter()

Support method for initNumericRangeFilters() -- build a filter query based on a range of numbers.

protected buildNumericRangeFilter(string $field, string $from, string $to) : string
Parameters
$field : string

field to use for filtering.

$from : string

number for start of range.

$to : string

number for end of range.

Return values
string

filter query.

formatDateForFullDateRange()

Support method for initFullDateFilters() -- normalize a date for use in a year/month/day date range.

protected formatDateForFullDateRange(string|null $date[, bool $rangeEnd = false ]) : string
Parameters
$date : string|null

Value to check for valid date.

$rangeEnd : bool = false

Is this the end of a range?

Return values
string

Formatted date.

formatFilterArrayAsQueryParams()

Format a raw filter array as a query parameter array.

protected formatFilterArrayAsQueryParams(array<string|int, mixed> $filterArray) : array<string|int, mixed>

Returns an array of strings that parseFilter can parse.

Parameters
$filterArray : array<string|int, mixed>

Filter array

Return values
array<string|int, mixed>

formatFilterListEntry()

Format a single filter for use in getFilterList().

protected formatFilterListEntry(string $field, string $value, string $operator, bool $translate) : array<string|int, mixed>
Parameters
$field : string

Field name

$value : string

Field value

$operator : string

Operator (AND/OR/NOT)

$translate : bool

Should we translate the label?

Return values
array<string|int, mixed>

formatValueForNumericRange()

Support method for initNumericRangeFilters() -- normalize a year for use in a date range.

protected formatValueForNumericRange(string|null $num[, bool $rangeEnd = false ]) : string
Parameters
$num : string|null

Value to format into a number.

$rangeEnd : bool = false

Is this the end of a range?

Tags
SuppressWarnings

(PHPMD.UnusedFormalParameter)

Return values
string

Formatted number.

formatYearForDateRange()

Support method for initDateFilters() -- normalize a year for use in a year-based date range.

protected formatYearForDateRange(string|null $year[, bool $rangeEnd = false ]) : string
Parameters
$year : string|null

Value to check for valid year.

$rangeEnd : bool = false

Is this the end of a range?

Tags
SuppressWarnings

(PHPMD.UnusedFormalParameter)

Return values
string

Formatted year.

getCheckboxFacetValues()

Get a formatted list of checkbox filter values ($field => array of values).

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

getFacetLimitForField()

Get the facet limit for the specified field.

protected getFacetLimitForField(string $field) : int
Parameters
$field : string

Field to look up

Return values
int

getFacetMatchesForField()

Get the facet matches for the specified field.

protected getFacetMatchesForField(string $field) : string
Parameters
$field : string

Field to look up

Return values
string

getFacetPrefixForField()

Get the facet prefix for the specified field.

protected getFacetPrefixForField(string $field) : string
Parameters
$field : string

Field to look up

Return values
string

getRawCheckboxFacets()

Return checkbox facets without any processing

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

initAdvancedSearch()

Support method for initSearch() -- handle advanced settings. Advanced searches have numeric subscripts on the lookfor and type parameters -- this is how they are distinguished from basic searches.

protected initAdvancedSearch(Parameters $request) : void
Parameters
$request : Parameters

Parameter object representing user request.

Return values
void

initBasicSearch()

Support method for initSearch() -- handle basic settings.

protected initBasicSearch(Parameters $request) : bool
Parameters
$request : Parameters

Parameter object representing user request.

Return values
bool

True if search settings were found, false if not.

initCheckboxFacets()

Initialize checkbox facet settings for the specified configuration sections.

protected initCheckboxFacets([string $facetList = 'CheckboxFacets' ][, string $cfgFile = null ]) : bool
Parameters
$facetList : string = 'CheckboxFacets'

Config section containing fields to activate

$cfgFile : string = null

Name of configuration to load (null to load default facets configuration).

Return values
bool

True if facets set, false if no settings found

initDateFilters()

Support method for initFilters() -- initialize year-based date filters.

protected initDateFilters(Parameters $request) : void

Factored out as a separate method so that it can be more easily overridden by child classes.

Parameters
$request : Parameters

Parameter object representing user request.

Return values
void

initFacetLimitsFromConfig()

Initialize facet limit from a Config object.

protected initFacetLimitsFromConfig([Config $config = null ]) : void
Parameters
$config : Config = null

Configuration

Return values
void

initFacetList()

Initialize facet settings for the specified configuration sections.

protected initFacetList(string $facetList, string $facetSettings[, string $cfgFile = null ]) : bool
Parameters
$facetList : string

Config section containing fields to activate

$facetSettings : string

Config section containing related settings

$cfgFile : string = null

Name of configuration to load (null to load default facets configuration).

Return values
bool

True if facets set, false if no settings found

initFacetRestrictionsFromConfig()

Initialize facet prefix and matches from a Config object.

protected initFacetRestrictionsFromConfig([Config $config = null ]) : void
Parameters
$config : Config = null

Configuration

Return values
void

initFilters()

Add filters to the object based on values found in the request object.

protected initFilters(Parameters $request) : void
Parameters
$request : Parameters

Parameter object representing user request.

Return values
void

initFullDateFilters()

Support method for initFilters() -- initialize year/month/day-based date filters. Factored out as a separate method so that it can be more easily overridden by child classes.

protected initFullDateFilters(Parameters $request) : void
Parameters
$request : Parameters

Parameter object representing user request.

Return values
void

initGenericRangeFilters()

Support method for initFilters() -- initialize range filters. Factored out as a separate method so that it can be more easily overridden by child classes.

protected initGenericRangeFilters(Parameters $request[, string $requestParam = 'genericrange' ][, callable $valueFilter = null ][, callable $filterGenerator = null ]) : void
Parameters
$request : Parameters

Parameter object representing user request.

$requestParam : string = 'genericrange'

Name of parameter containing names of range filter fields.

$valueFilter : callable = null

Optional callback to process values in the range.

$filterGenerator : callable = null

Optional callback to create a filter query from the range values.

Return values
void

initHiddenFilters()

Add hidden filters to the object based on values found in the request object.

protected initHiddenFilters(Parameters $request) : void
Parameters
$request : Parameters

Parameter object representing user request.

Return values
void

initLimit()

Pull the page size parameter or set to default

protected initLimit(Parameters $request) : void
Parameters
$request : Parameters

Parameter object representing user request.

Return values
void

initNumericRangeFilters()

Support method for initFilters() -- initialize numeric range filters. Factored out as a separate method so that it can be more easily overridden by child classes.

protected initNumericRangeFilters(Parameters $request) : void
Parameters
$request : Parameters

Parameter object representing user request.

Return values
void

initPage()

Pull the page parameter

protected initPage(Parameters $request) : void
Parameters
$request : Parameters

Parameter object representing user request.

Return values
void

initRangeFilters()

Initialize all range filters.

protected initRangeFilters(Parameters $request) : void
Parameters
$request : Parameters

Parameter object representing user request.

Return values
void

initSearch()

Initialize the object's search settings from a request object.

protected initSearch(Parameters $request) : void
Parameters
$request : Parameters

Parameter object representing user request.

Return values
void

initShards()

Pull shard parameters from the request or set defaults

protected initShards(Parameters $request) : void
Parameters
$request : Parameters

Parameter object representing user request.

Return values
void

initSort()

Get the value for which type of sorting to use

protected initSort(Parameters $request) : void
Parameters
$request : Parameters

Parameter object representing user request.

Return values
void

initView()

Get the value for which results view to use

protected initView(Parameters $request) : void
Parameters
$request : Parameters

Parameter object representing user request.

Return values
void

normalizeSort()

Normalize sort parameters.

protected normalizeSort(string $sort) : string
Parameters
$sort : string

Sort parameter

Return values
string

parseOperatorAndFieldName()

Parse the operator and field name from a prefixed field string.

protected parseOperatorAndFieldName(string $field) : array<string|int, mixed>
Parameters
$field : string

Prefixed string

Return values
array<string|int, mixed>

(0 = operator, 1 = field name)

Search results