SilverStripe Search

QueryInterface

Table of Contents

Methods

addFilter()  : self
addOrFilter()  : self
addTerm()  : $this
Add a term to search on.
getFilters()  : array<string|int, mixed>
getOrFilters()  : array<string|int, mixed>
getTerms()  : array<string|int, mixed>
setFilters()  : self
setOrFilters()  : self
setTerms()  : self

Methods

addFilter()

public addFilter(string $key, string $value) : self
Parameters
$key : string
$value : string
Return values
self

addOrFilter()

public addOrFilter(string $key, string $value) : self
Parameters
$key : string
$value : string
Return values
self

addTerm()

Add a term to search on.

public addTerm(string $term[, array<string|int, mixed> $fields = [] ][, int $boost = 1 ][, float|bool|null $fuzzy = null ]) : $this

Note, each boosted query needs a separate addition! e.g. $this->addTerm('test', ['MyField', 'MyOtherField'], 3) followed by $this->addTerm('otherTest', ['Title'], 5);

If you want a generic boost on all terms, use addTerm only once, but boost on each field

The fields parameter is used to boost on

Parameters
$term : string

Term to search for

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

fields to boost on

$boost : int = 1

Boost value

$fuzzy : float|bool|null = null

True or a value to the maximum amount of iterations

Return values
$this

getFilters()

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

getOrFilters()

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

getTerms()

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

setFilters()

public setFilters(array<string|int, mixed> $filters) : self
Parameters
$filters : array<string|int, mixed>
Return values
self

setOrFilters()

public setOrFilters(array<string|int, mixed> $filters) : self
Parameters
$filters : array<string|int, mixed>
Return values
self

setTerms()

public setTerms(mixed $terms) : self
Parameters
$terms : mixed
Return values
self

        
On this page

Search results