Constants

OPERATOR_AND

OPERATOR_AND

OPERATOR_OR

OPERATOR_OR

Properties

$_params

$_params : array

Params.

Type

array

$_rawParams

$_rawParams : array

Raw Params.

Type

array

$_field

$_field : string

Type

string

$_queryParams

$_queryParams : array

Type

array

Methods

toArray()

toArray() : array

Returns

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

__construct()

__construct(string  $field, string  $query, float  $cutoffFrequency) 

Parameters

string $field

the field on which to query

string $query

the query string

float $cutoffFrequency

percentage in decimal form (.001 == 0.1%)

setField()

setField(string  $field) : $this

Set the field on which to query.

Parameters

string $field

the field on which to query

Returns

$this

setQuery()

setQuery(string  $query) : $this

Set the query string for this query.

Parameters

string $query

Returns

$this

setCutoffFrequency()

setCutoffFrequency(float  $frequency) : $this

Set the frequency below which terms will be put in the low frequency group.

Parameters

float $frequency

percentage in decimal form (.001 == 0.1%)

Returns

$this

setLowFrequencyOperator()

setLowFrequencyOperator(string  $operator) : $this

Set the logic operator for low frequency terms.

Parameters

string $operator

see OPERATOR_* class constants for options

Returns

$this

setHighFrequencyOperator()

setHighFrequencyOperator(string  $operator) : $this

Set the logic operator for high frequency terms.

Parameters

string $operator

see OPERATOR_* class constants for options

Returns

$this

setMinimumShouldMatch()

setMinimumShouldMatch(integer|string  $minimum) : $this

Set the minimum_should_match parameter.

Parameters

integer|string $minimum

minimum number of low frequency terms which must be present

Returns

$this

setBoost()

setBoost(float  $boost) : $this

Set the boost for this query.

Parameters

float $boost

Returns

$this

setAnalyzer()

setAnalyzer(string  $analyzer) : $this

Set the analyzer for this query.

Parameters

string $analyzer

Returns

$this

setDisableCoord()

setDisableCoord(boolean  $disable = true) : $this

Enable / disable computation of score factor based on the fraction of all query terms contained in the document.

Parameters

boolean $disable

disable_coord is false by default

Returns

$this

setQueryParam()

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

Set a parameter in the body of this query.

Parameters

string $key

parameter key

mixed $value

parameter value

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