lib/Elastica/Query/FunctionScore.php
public function addDecayFunction(
        string $function,
        string $field,
        string $origin,
        string $scale,
        string $offset = null,
        float $decay = null,
        float $weight = null,
        AbstractQuery $filter = null,
        string $multiValueMode = null
    ) {
        $functionParams = [
            $field => [
                'origin' => $origin,
                'scale' => $scale,
            ],
        ];
        if (null !== $offset) {
            $functionParams[$field]['offset'] = $offset;
        }
        if (null !== $decay) {
            $functionParams[$field]['decay'] = $decay;
        }

        if (null !== $multiValueMode) {
            $functionParams['multi_value_mode'] = $multiValueMode;
        }

        return $this->addFunction($function, $functionParams, $filter, $weight);
    }
public function addDecayFunction(
        string $function,
        string $field,
        string $origin,
        string $scale,
        string $offset = null,
        float $decay = null,
        float $weight = null,
        AbstractQuery $filter = null,
        string $multiValueMode = null
    ) {
        $functionParams = [
            $field => [
                'origin' => $origin,
                'scale' => $scale,
            ],
        ];
        if (null !== $offset) {
            $functionParams[$field]['offset'] = $offset;
        }
        if (null !== $decay) {
            $functionParams[$field]['decay'] = $decay;
        }

        if (null !== $multiValueMode) {
            $functionParams['multi_value_mode'] = $multiValueMode;
        }

        return $this->addFunction($function, $functionParams, $filter, $weight);
    }
public function addDecayFunction ( string $ function , string $ field , string $ origin , string $ scale , string $ offset = null , float $ decay = null , float $ weight = null , AbstractQuery $ filter = null , string $ multiValueMode = null ) { $ functionParams = [ $ field => [ 'origin' => $ origin , 'scale' => $ scale , ] , ] ; if ( null !== $ offset ) { $ functionParams [ $ field ] [ 'offset' ] = $ offset ; } if ( null !== $ decay ) { $ functionParams [ $ field ] [ 'decay' ] = $ decay ; } if ( null !== $ multiValueMode ) { $ functionParams [ 'multi_value_mode' ] = $ multiValueMode ; } return $ this -> addFunction ( $ function , $ functionParams , $ filter , $ weight ) ; }
Add a decay function to the query.

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

@return $this
Add a decay function to the query .