Constants

TYPE_BEST_FIELDS

TYPE_BEST_FIELDS

TYPE_MOST_FIELDS

TYPE_MOST_FIELDS

TYPE_CROSS_FIELDS

TYPE_CROSS_FIELDS

TYPE_PHRASE

TYPE_PHRASE

TYPE_PHRASE_PREFIX

TYPE_PHRASE_PREFIX

OPERATOR_OR

OPERATOR_OR

OPERATOR_AND

OPERATOR_AND

ZERO_TERM_NONE

ZERO_TERM_NONE

ZERO_TERM_ALL

ZERO_TERM_ALL

FUZZINESS_AUTO

FUZZINESS_AUTO

Properties

$_params

$_params : array

Params.

Type

array

$_rawParams

$_rawParams : array

Raw Params.

Type

array

Methods

toArray()

toArray() : array

Converts the params to an array. A default implementation exist to create the an array out of the class name (last part of the class name) and the params.

Returns

array —

Filter array

setParam()

setParam(string  $key, mixed  $value) : $this

Sets (overwrites) the value at the given key.

Parameters

string $key

Key to set

mixed $value

Key Value

Returns

$this

setParams()

setParams(array  $params) : $this

Sets (overwrites) all params of this object.

Parameters

array $params

Parameter list

Returns

$this

addParam()

addParam(string  $key, mixed  $value) : $this

Adds a param to the list.

This function can be used to add an array of params

Parameters

string $key

Param key

mixed $value

Value to set

Returns

$this

getParam()

getParam(string  $key) : mixed

Returns a specific param.

Parameters

string $key

Key to return

Throws

\Elastica\Exception\InvalidException

If requested key is not set

Returns

mixed —

Key value

hasParam()

hasParam(string  $key) : boolean

Test if a param is set.

Parameters

string $key

Key to test

Returns

boolean —

True if the param is set, false otherwise

getParams()

getParams() : array

Returns the params array.

Returns

array —

Params

setQuery()

setQuery(string  $query = '') : $this

Sets the query.

Parameters

string $query

Query

Returns

$this

setFields()

setFields(array  $fields = array()) : $this

Sets Fields to be used in the query.

Parameters

array $fields

Fields

Returns

$this

setUseDisMax()

setUseDisMax(boolean  $useDisMax = true) : $this

Sets use dis max indicating to either create a dis_max query or a bool query.

If not set, defaults to true.

Parameters

boolean $useDisMax

Returns

$this

setTieBreaker()

setTieBreaker(float  $tieBreaker = 0.0) : $this

Sets tie breaker to multiplier value to balance the scores between lower and higher scoring fields.

If not set, defaults to 0.0.

Parameters

float $tieBreaker

Returns

$this

setOperator()

setOperator(string  $operator = 'or') : $this

Sets operator for Match Query.

If not set, defaults to 'or'

Parameters

string $operator

Returns

$this

setMinimumShouldMatch()

setMinimumShouldMatch(mixed  $minimumShouldMatch) : $this

Set field minimum should match for Match Query.

Parameters

mixed $minimumShouldMatch

Returns

$this

setZeroTermsQuery()

setZeroTermsQuery(string  $zeroTermQuery = 'none') : $this

Set zero terms query for Match Query.

If not set, default to 'none'

Parameters

string $zeroTermQuery

Returns

$this

setCutoffFrequency()

setCutoffFrequency(float  $cutoffFrequency) : $this

Set cutoff frequency for Match Query.

Parameters

float $cutoffFrequency

Returns

$this

setType()

setType(string  $type) : $this

Set type.

Parameters

string $type

Returns

$this

setFuzziness()

setFuzziness(float|string  $fuzziness) : $this

Set fuzziness.

Parameters

float|string $fuzziness

Returns

$this

setPrefixLength()

setPrefixLength(integer  $prefixLength) : $this

Set prefix length.

Parameters

integer $prefixLength

Returns

$this

setMaxExpansions()

setMaxExpansions(integer  $maxExpansions) : $this

Set max expansions.

Parameters

integer $maxExpansions

Returns

$this

setAnalyzer()

setAnalyzer(string  $analyzer) : $this

Set analyzer.

Parameters

string $analyzer

Returns

$this

_convertArrayable()

_convertArrayable(array  $array) : array

Cast objects to arrays.

Parameters

array $array

Returns

array

_getBaseName()

_getBaseName() : string

Param's name Picks the last part of the class name and makes it snake_case You can override this method if you want to change the name.

Returns

string —

name

_setRawParam()

_setRawParam(string  $key, mixed  $value) : $this

Sets params not inside params array.

Parameters

string $key
mixed $value

Returns

$this