PHP Class Bolt\Storage\Query\SearchQuery

@link https://docs.bolt.cm/content-search The resulting QueryBuilder object is then passed through to the individual field handlers where they can perform value transformations.
Author: Ross Riley ([email protected])
Inheritance: extends SelectQuery, implements Bolt\Storage\Query\QueryInterface
Show file Open project: bolt/bolt

Protected Properties

Property Type Description
$config SearchConfig
$search string

Public Methods

Method Description
__construct ( Doctrine\DBAL\Query\QueryBuilder $qb, QueryParameterParser $parser, SearchConfig $config ) Constructor.
getSearchWords ( ) : array Gets the individual elements of the search query as an array
getWhereExpression ( ) : CompositeExpression | null Creates a composite expression that adds all the attached filters individual expressions into a combined one.
setParameters ( array $params ) Sets the overall parameters on the query. This may include others than the search query itself which gets set to the 'filter' param.
setSearch ( string $search ) This method sets the search filter which then triggers the process method.

Protected Methods

Method Description
getSearchParameter ( ) : string This is an internal helper method to get the search words prepared to be passed to the expression builder.
processFilters ( ) This overrides the SelectQuery default to do some extra preparation for a search query.

Method Details

__construct() public method

Constructor.
public __construct ( Doctrine\DBAL\Query\QueryBuilder $qb, QueryParameterParser $parser, SearchConfig $config )
$qb Doctrine\DBAL\Query\QueryBuilder
$parser QueryParameterParser
$config SearchConfig

getSearchParameter() protected method

This is an internal helper method to get the search words prepared to be passed to the expression builder.
protected getSearchParameter ( ) : string
return string

getSearchWords() public method

Gets the individual elements of the search query as an array
public getSearchWords ( ) : array
return array

getWhereExpression() public method

Creates a composite expression that adds all the attached filters individual expressions into a combined one.
public getWhereExpression ( ) : CompositeExpression | null
return Doctrine\DBAL\Query\Expression\CompositeExpression | null

processFilters() protected method

Firstly it builds separate filters for the search query and then it removes the filter from the params and the others will then get processed normally by the parent.
protected processFilters ( )

setParameters() public method

Sets the overall parameters on the query. This may include others than the search query itself which gets set to the 'filter' param.
public setParameters ( array $params )
$params array

setSearch() public method

This method sets the search filter which then triggers the process method.
public setSearch ( string $search )
$search string full search query

Property Details

$config protected property

protected SearchConfig,Bolt\Storage\Query $config
return SearchConfig