Properties

$_params

$_params : array

Params.

Type

array

$_rawParams

$_rawParams : array

Raw Params.

Type

array

$_queryString

$_queryString : string

Query string.

Type

string — Query string

Methods

toArray()

toArray() : array

Converts query to array.

Returns

array —

Query 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  $queryString = '') 

Creates query string object. Calls setQuery with argument.

Parameters

string $queryString

OPTIONAL Query string for object

setQuery()

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

Sets a new query string for the object.

Parameters

string $query

Query string

Throws

\Elastica\Exception\InvalidException

If given parameter is not a string

Returns

$this

setDefaultField()

setDefaultField(string  $field) : $this

Sets the default field.

If no field is set, _all is chosen

Parameters

string $field

Field

Returns

$this

setDefaultOperator()

setDefaultOperator(string  $operator) : $this

Sets the default operator AND or OR.

If no operator is set, OR is chosen

Parameters

string $operator

Operator

Returns

$this

setAnalyzer()

setAnalyzer(string  $analyzer) : $this

Sets the analyzer to analyze the query with.

Parameters

string $analyzer

Analyser to use

Returns

$this

setAllowLeadingWildcard()

setAllowLeadingWildcard(boolean  $allow = true) : $this

Sets the parameter to allow * and ? as first characters.

If not set, defaults to true.

Parameters

boolean $allow

Returns

$this

setEnablePositionIncrements()

setEnablePositionIncrements(boolean  $enabled = true) : $this

Sets the parameter to enable the position increments in result queries.

If not set, defaults to true.

Parameters

boolean $enabled

Returns

$this

setFuzzyPrefixLength()

setFuzzyPrefixLength(integer  $length) : $this

Sets the fuzzy prefix length parameter.

If not set, defaults to 0.

Parameters

integer $length

Returns

$this

setFuzzyMinSim()

setFuzzyMinSim(float  $minSim = 0.5) : $this

Sets the fuzzy minimal similarity parameter.

If not set, defaults to 0.5

Parameters

float $minSim

Returns

$this

setPhraseSlop()

setPhraseSlop(integer  $phraseSlop) : $this

Sets the phrase slop.

If zero, exact phrases are required. If not set, defaults to zero.

Parameters

integer $phraseSlop

Returns

$this

setBoost()

setBoost(float  $boost = 1.0) : $this

Sets the boost value of the query.

If not set, defaults to 1.0.

Parameters

float $boost

Returns

$this

setAnalyzeWildcard()

setAnalyzeWildcard(boolean  $analyze = true) : $this

Allows analyzing of wildcard terms.

If not set, defaults to true

Parameters

boolean $analyze

Returns

$this

setAutoGeneratePhraseQueries()

setAutoGeneratePhraseQueries(boolean  $autoGenerate = true) : $this

Sets the param to automatically generate phrase queries.

If not set, defaults to true.

Parameters

boolean $autoGenerate

Returns

$this

setFields()

setFields(array  $fields) : $this

Sets the fields. If no fields are set, _all is chosen.

Parameters

array $fields

Fields

Throws

\Elastica\Exception\InvalidException

If given parameter is not an array

Returns

$this

setUseDisMax()

setUseDisMax(boolean  $value = true) : $this

Whether to use bool or dis_max queries to internally combine results for multi field search.

Parameters

boolean $value

Determines whether to use

Returns

$this

setTieBreaker()

setTieBreaker(integer  $tieBreaker) : $this

When using dis_max, the disjunction max tie breaker.

If not set, defaults to 0.

Parameters

integer $tieBreaker

Returns

$this

setRewrite()

setRewrite(string  $rewrite = '') : $this

Set a re-write condition. See https://github.com/elasticsearch/elasticsearch/issues/1186 for additional information.

Parameters

string $rewrite

Returns

$this

setTimezone()

setTimezone(string  $timezone) : $this

Set timezone option.

Parameters

string $timezone

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