\Elastica\SuggestAbstractSuggest

Class AbstractSuggestion.

This function can be used to handle params for queries, filter

Summary

Methods
Properties
Constants
toArray()
setParam()
setParams()
addParam()
getParam()
hasParam()
getParams()
__construct()
setText()
setPrefix()
setRegex()
setRegexOptions()
setField()
setSize()
setShardSize()
setName()
getName()
No public properties found
No constants found
_convertArrayable()
_getBaseName()
_setRawParam()
$_params
$_rawParams
$_name
N/A
No private methods found
No private properties found
N/A

Properties

$_params

$_params : array

Params.

Type

array

$_rawParams

$_rawParams : array

Raw Params.

Type

array

$_name

$_name : string

Type

string — the name of this suggestion

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

__construct()

__construct(string  $name, string  $field) 

Parameters

string $name
string $field

setText()

setText(string  $text) : $this

Suggest text must be set either globally or per suggestion.

Parameters

string $text

Returns

$this

setPrefix()

setPrefix(  $prefix) : $this

Suggest prefix must be set either globally or per suggestion.

Parameters

$prefix

Returns

$this

setRegex()

setRegex(  $regex) : $this

Suggest regex must be set either globally or per suggestion.

Parameters

$regex

Returns

$this

setRegexOptions()

setRegexOptions(array  $value) : $this

Expects one of the next params: max_determinized_states - defaults to 10000, flags are ALL (default), ANYSTRING, COMPLEMENT, EMPTY, INTERSECTION, INTERVAL, or NONE.

Parameters

array $value

Returns

$this

setField()

setField(string  $field) : $this

Parameters

string $field

Returns

$this

setSize()

setSize(integer  $size) : $this

Parameters

integer $size

Returns

$this

setShardSize()

setShardSize(integer  $size) : $this

Parameters

integer $size

maximum number of suggestions to be retrieved from each shard

Returns

$this

setName()

setName(string  $name) : $this

Sets the name of the suggest. It is automatically set by the constructor.

Parameters

string $name

The name of the suggest

Throws

\Elastica\Exception\InvalidException

If name is empty

Returns

$this

getName()

getName() : string

Retrieve the name of this suggestion.

Returns

string

_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