lib/Elastica/Query/FunctionScore.php
public function addFunction(
        string $functionType,
        $functionParams,
        AbstractQuery $filter = null,
        float $weight = null
    ): self {
        $function = [
            $functionType => $functionParams,
        ];

        if (null !== $filter) {
            $function['filter'] = $filter;
        }

        if (null !== $weight) {
            $function['weight'] = $weight;
        }

        $this->_functions[] = $function;

        return $this;
    }
public function addFunction(
        string $functionType,
        $functionParams,
        AbstractQuery $filter = null,
        float $weight = null
    ): self {
        $function = [
            $functionType => $functionParams,
        ];

        if (null !== $filter) {
            $function['filter'] = $filter;
        }

        if (null !== $weight) {
            $function['weight'] = $weight;
        }

        $this->_functions[] = $function;

        return $this;
    }
public function addFunction ( string $ functionType , $ functionParams , AbstractQuery $ filter = null , float $ weight = null ) : self { $ function = [ $ functionType => $ functionParams , ] ; if ( null !== $ filter ) { $ function [ 'filter' ] = $ filter ; } if ( null !== $ weight ) { $ function [ 'weight' ] = $ weight ; } $ this -> _functions [ ] = $ function ; return $ this ; }
Add a function to the function_score query.

@param string                     $functionType   valid values are DECAY_* constants and script_score
@param array|float|AbstractScript $functionParams the body of the function. See documentation for proper syntax.
@param AbstractQuery              $filter         filter to apply to the function
@param float                      $weight         function weight

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