Creates field_value_factor function.

@param string           $field
@param float            $factor
@param string           $modifier
@param BuilderInterface $query

@return $this
497320
public function addFieldValueFactorFunction($field, $factor, $modifier = 'none', BuilderInterface $query = null)
    {
        $function = [
            'field_value_factor' => [
                'field' => $field,
                'factor' => $factor,
                'modifier' => $modifier,
            ],
        ];

        $this->applyFilter($function, $query);

        $this->functions[] = $function;

        return $this;
    }
335983
public function addDriver(DriverInterface $driver, /*# int */ $factor = 1)
    {
        // get unique driver id
        $id = $this->getDriverId($driver);

        // fix factor range: 1 - 10
        $this->factors[$id] = $this->fixFactor($factor);

        // add to the pool
        $this->drivers[$id] = $driver;

        return $this;
    }
839345
public function build(QueryInterface $query, QueryBuilder $queryBuilder, ScoringQueryBuilder $scoringQueryBuilder)
    {
        $tokens = $this->analyzer->analyze($query->getQuery());
        $length = count($tokens);

        $scoringQueryBuilder->open();

        $or = $queryBuilder->expr()->orX();
        foreach ($tokens as $index => $token) {
            $scoringQueryBuilder->open();

            $scoringQueryBuilder->queryNorm($tokens);
            $scoringQueryBuilder->multiply();
            $scoringQueryBuilder->inverseDocumentFrequency($token->getTerm());
            $scoringQueryBuilder->multiply();
            $scoringQueryBuilder->coord($query->getField(), $tokens);
            $scoringQueryBuilder->multiply();

            $scoringQueryBuilder->open();

            $or->add(
                $this->termQueryBuilder->build(
                    new Term($query->getField(), $token->getTerm()),
                    $queryBuilder,
                    $scoringQueryBuilder
                )
            );

            $scoringQueryBuilder->close();
            $scoringQueryBuilder->close();

            if ($index != $length - 1) {
                $scoringQueryBuilder->addition();
            }
        }

        $scoringQueryBuilder->close();

        return $or;
    }
912427
public static function createFieldBoosting(
        string $field,
        float $factor = self::DEFAULT_FACTOR,
        float $missing = self::DEFAULT_MISSING,
        string $modifier = self::MODIFIER_NONE,
        float $weight = self::DEFAULT_WEIGHT,
        Filter $filter = null,
        string $scoreMode = self::SCORE_MODE_AVG
    ): ScoreStrategy {
        $scoreStrategy = self::createDefault();
        $scoreStrategy->type = self::BOOSTING_FIELD_VALUE;
        $scoreStrategy->configuration['field'] = $field;
        $scoreStrategy->configuration['factor'] = $factor;
        $scoreStrategy->configuration['missing'] = $missing;
        $scoreStrategy->configuration['modifier'] = $modifier;
        $scoreStrategy->weight = $weight;
        $scoreStrategy->filter = self::fixFilterFieldPath($filter);
        $scoreStrategy->scoreMode = $scoreMode;

        return $scoreStrategy;
    }
1306892
public function setFieldValue($document, $field, $value)
    {
        $this->reflFields[$field]->setValue($document, $value);
    }
611295
public function setModifier(EventManagerAwareInterface $modifier)
    {
        parent::setModifier($modifier);
        $this->modifier->getEventManager()->attach(ModifiableInterface::PHASE_PRE_BUILD, [$this,'preBuildListener']);
    }
169248
public static Transformer<FieldDescription> withModifiers(List<? extends ModifierContributor.ForField> modifierContributors) {
            return new ForField(new FieldModifierTransformer(ModifierContributor.Resolver.of(modifierContributors)));
        }
1004828
public function push(Field $field){

        $this->offsetSet($field->getName(), $field);

        $numArgs = func_num_args();

        if($numArgs > 1){
            $args = func_get_args();
            for($i=1;$i<$numArgs;$i++){
                $this->push($args[$i]);
            }
        }
        return $this;
    }
970536
public function getQuery($specification, ResultModifier $modifier = null)
    {
        $query = $this->getQueryBuilder($specification)->getQuery();

        if (null !== $modifier) {
            $modifier->modify($query);
        }

        return $query;
    }
896639
public function addPropertyValue(&$entity, $field, $value)
    {
        $container = $this->getPropertyValue($entity, $field, $entity);

        if (!is_array($container)) {
            $container = empty($container) ? [] : [$container];
        }
        $container[] = $value;

        $this->setPropertyValue($entity, $field, $container);
    }
271307
public function apply(Builder $query, $or = false)
    {
        $field_alias = $this->field_alias;

        if($or)
        {
            $query->orWhere($field_alias, '<', $this->value);
        }
        else
        {
            $query->where($field_alias, '<', $this->value);
        }
    }
1179885
public function apply(Builder $query, $or = false)
    {
        $field_alias = $this->field_alias;

        if(is_array($this->value))
        {
            if($or)
            {
                $query->orWhereNotIn($field_alias, $this->value);
            }
            else
            {
                $query->whereNotIn($field_alias, $this->value);
            }
        }
        else
        {
            if($or)
            {
                $query->orWhere($field_alias, '!=', $this->value);
            }
            else
            {
                $query->where($field_alias, '!=', $this->value);
            }
        }
    }
234071
private function applyNestedFilter(Builder $query, array $fields, $operator, $value, $or = false)
    {
        $relation_name = implode('.', array_slice($fields, 0, count($fields) - 1));
        $relation_field = end($fields);
        if ($relation_name[0] == '!') {
            $relation_name = substr($relation_name, 1, strlen($relation_name));

            $that = $this;

            return $query->whereHas($relation_name, function ($query) use ($relation_field, $operator, $value, $that, $or) {
                $query = $that->applyWhereClause($query, $relation_field, $operator, $value, $or);
            }, '=', 0);
        }

        $that = $this;

        return $query->whereHas($relation_name, function ($query) use ($relation_field, $operator, $value, $that, $or) {
            $query = $that->applyWhereClause($query, $relation_field, $operator, $value, $or);
        });
    }
286630
public function addFilter($field, $value, $operator)
    {
        if ((is_numeric($field) || !empty($field)) && (!empty($value) || $value == '0')) {
            if (!is_null($operator)) {
                $this->filters[$field][$operator] = $value;
            } else {
                $this->filters[$field] = $value;
            }
        }

        return $this;
    }
236653
public function field($field) : FormFieldBindingDefiner
    {
        if ($field instanceof FieldBuilderBase) {
            $field = $field->build();
        }

        InvalidArgumentException::verifyInstanceOf(__METHOD__, 'field', $field, IField::class);

        return new FormFieldBindingDefiner($this->class, $field);
    }
854804
private function modifyQuery(QueryBuilder $queryBuilder, ModifierInterface $modifier = null)
    {
        $query = $queryBuilder->getQuery();

        if ($modifier) {
            $modifier->modify($query);
        }

        return $query;
    }
1154636
public function buildQuery($type, $field = null, $extra = null)
    {
        if($type == 'select') {
            if($field == null) {
                $field = "*";
            }
            elseif(is_array($field)) {
                foreach($field as $i => $value) {
                    $field[$i] = '`'.trim($value).'`';
                }
                $field = trim(implode(' ,', $field));
            }
            $ex = '';
            if($extra != null && is_array($extra)) {
                foreach($extra as $i => $v) {
                    if($i == 'count') {
                        $ex .= 'COUNT';
                        if($v == null) {
                            $ex .= '(*)';
                        }
                    }
                    if($i == 'field') {
                        $ex .= ' as `'.$v.'`';
                    }
                }
                $sql = "SELECT $ex FROM `".$this->getTable().'` '.$this->where;
            }
            else {
                $sql = "SELECT $field FROM `".$this->getTable().'` '.$this->where.$this->order.$this->limit;
            }
        }
        elseif($type == 'insert') {
            if(is_array($field)) {
                $keys = array_keys($field);
                if($keys[0] === 0) {
                    $keys = '';
                }
                else {
                    foreach($keys as $i => $key) {
                        $keys[$i] = ' `'.trim($key).'`';
                    }
                    $keys = implode(',', $keys);
                }
                $values = array_values($field);
                foreach($values as $i => $val) {
                    $values[$i] = is_string($val) ? "'$val'" : $val;
                }
                $values = implode(' ,', $values);
            }
            else {
                $keys = '';
                $values = trim($field);
            }
            $values = "($values)";
            $keys = ($keys !== '') ? "($keys)" : '';
            $sql = "INSERT INTO `".$this->getTable()."` $keys VALUES $values".$this->duplicateUpdate;
        }
        elseif($type == 'update') {
            if(is_array($field)) {
                foreach($field as $key => $value) {
                    $values[] = " `$key` = ".(is_string($value) ? "'$value'" : $value);
                }
                $values = implode(' ,', $values);
            }
            else {
                $values = trim($field);
            }
            $sql = "UPDATE `".$this->getTable()."` SET $values ".$this->where;
        }
        elseif($type == 'delete') {
            $sql = "DELETE FROM `".$this->getTable()."` ".$this->where;
        }
        $this->query = $sql;
        return $sql;
    }