PHP Class Elastica\Query\FunctionScore

Inheritance: extends AbstractQuery
Show file Open project: ruflin/elastica Class Usage Examples

Protected Properties

Property Type Description
$_functions

Public Methods

Method Description
addDecayFunction ( string $function, string $field, string $origin, string $scale, string $offset = null, float $decay = null, float $weight = null, AbstractQuery $filter = null, string $multiValueMode = null ) Add a decay function to the query.
addFieldValueFactorFunction ( $field, $factor = null, $modifier = null, $missing = null, $weight = null, AbstractQuery $filter = null )
addFunction ( string $functionType, array | float $functionParams, AbstractQuery $filter = null, float $weight = null ) Add a function to the function_score query.
addRandomScoreFunction ( number $seed, AbstractQuery $filter = null, float $weight = null ) Add a random_score function to the query.
addScriptScoreFunction ( Elastica\Script\AbstractScript $script, AbstractQuery $filter = null, float $weight = null ) Add a script_score function to the query.
addWeightFunction ( float $weight, AbstractQuery $filter = null )
setBoost ( float $boost ) Set an overall boost value for this query.
setBoostMode ( string $mode ) The boost mode determines how the score of this query is combined with that of the child query.
setMaxBoost ( float $maxBoost ) Restrict the combined boost of the function_score query and its child query.
setMinScore ( float $minScore ) Set min_score option.
setQuery ( AbstractQuery $query ) Set the child query for this function_score query.
setRandomScore ( integer $seed = null ) If set, this query will return results in random order.
setScoreMode ( string $mode ) Set the score method.
toArray ( ) : array

Method Details

addDecayFunction() public method

Add a decay function to the query.
public addDecayFunction ( string $function, string $field, string $origin, string $scale, string $offset = null, float $decay = null, float $weight = null, AbstractQuery $filter = null, string $multiValueMode = null )
$function string see DECAY_* constants for valid options
$field string the document field on which to perform the decay function
$origin string the origin value for this decay function
$scale string a scale to define the rate of decay for this function
$offset string If defined, this function will only be computed for documents with a distance from the origin greater than this value
$decay float optionally defines how documents are scored at the distance given by the $scale parameter
$weight float optional factor by which to multiply the score at the value provided by the $scale parameter
$filter AbstractQuery a filter associated with this function
$multiValueMode string see MULTI_VALUE_MODE_* constants for valid options

addFieldValueFactorFunction() public method

public addFieldValueFactorFunction ( $field, $factor = null, $modifier = null, $missing = null, $weight = null, AbstractQuery $filter = null )
$filter AbstractQuery

addFunction() public method

Add a function to the function_score query.
public addFunction ( string $functionType, array | float $functionParams, AbstractQuery $filter = null, float $weight = null )
$functionType string valid values are DECAY_* constants and script_score
$functionParams array | float the body of the function. See documentation for proper syntax.
$filter AbstractQuery optional filter to apply to the function
$weight float function weight

addRandomScoreFunction() public method

Add a random_score function to the query.
public addRandomScoreFunction ( number $seed, AbstractQuery $filter = null, float $weight = null )
$seed number the seed value
$filter AbstractQuery a filter associated with this function
$weight float an optional boost value associated with this function

addScriptScoreFunction() public method

Add a script_score function to the query.
public addScriptScoreFunction ( Elastica\Script\AbstractScript $script, AbstractQuery $filter = null, float $weight = null )
$script Elastica\Script\AbstractScript a Script object
$filter AbstractQuery an optional filter to apply to the function
$weight float the weight of the function

addWeightFunction() public method

public addWeightFunction ( float $weight, AbstractQuery $filter = null )
$weight float the weight of the function
$filter AbstractQuery a filter associated with this function

setBoost() public method

Set an overall boost value for this query.
public setBoost ( float $boost )
$boost float

setBoostMode() public method

The boost mode determines how the score of this query is combined with that of the child query.
public setBoostMode ( string $mode )
$mode string see BOOST_MODE_* constants for valid options. Default is multiply.

setMaxBoost() public method

Restrict the combined boost of the function_score query and its child query.
public setMaxBoost ( float $maxBoost )
$maxBoost float

setMinScore() public method

Set min_score option.
public setMinScore ( float $minScore )
$minScore float

setQuery() public method

Set the child query for this function_score query.
public setQuery ( AbstractQuery $query )
$query AbstractQuery

setRandomScore() public method

If set, this query will return results in random order.
public setRandomScore ( integer $seed = null )
$seed integer Set a seed value to return results in the same random order for consistent pagination.

setScoreMode() public method

Set the score method.
public setScoreMode ( string $mode )
$mode string see SCORE_MODE_* constants for valid options. Default is multiply.

toArray() public method

public toArray ( ) : array
return array

Property Details

$_functions protected property

protected $_functions