Add one boosting query
@return OpenSearchServer\Search\Search
328071
public function boostingQuery($query, $boost = 1) {
		if(empty($this->data['boostingQueries'])) {
			$this->data['boostingQueries'] = array();
		}
		$newBoosting = array(
			'patternQuery' => $query,
			'boost' => $boost
		);
		$this->data['boostingQueries'][] = $newBoosting;
		return $this;
	}
116212
public function newQuery()
    {
        $builder = new self($this->mapper, $this->adapter);

        return $this->applyGlobalScopes($builder);
    }
1199970
protected function createQuery()
    {
        if (!$this->queryCreated) {
            $this->setBaseQuery();
            if (!isset($this->showInactiveUsers)) {
                $this->filter('u.uIsActive', 1);
            }
            if (!$this->showInvalidatedUsers) {
                $this->filter('u.uIsValidated', 0, '!=');
            }
            $this->setupAttributeFilters("left join UserSearchIndexAttributes on (UserSearchIndexAttributes.uID = u.uID)");
            $this->queryCreated = 1;
        }
    }
225539
public function filtering()
    {
        $this->query->where(
                function ($query) {
            $globalKeyword = $this->setupKeyword($this->request->keyword());
            $queryBuilder  = $this->getQueryBuilder($query);
            if ($this->request->hasHeader('search-protection')) {
                $this->request->setSearchableColumnIndex($this->columns, $this->columnDef['filter']);
            }

            foreach ($this->request->searchableColumnIndex() as $index) {
                $columnName = $this->getColumnName($index);
                if ($this->isBlacklisted($columnName)) {
                    continue;
                }

                // check if custom column filtering is applied
                if (isset($this->columnDef['filter'][$columnName])) {
                    $columnDef         = $this->columnDef['filter'][$columnName];
                    // check if global search should be applied for the specific column
                    $applyGlobalSearch = count($columnDef['parameters']) == 0 || end($columnDef['parameters']) !== false;
                    if (!$applyGlobalSearch) {
                        continue;
                    }

                    if ($columnDef['method'] instanceof Closure) {
                        $whereQuery = $queryBuilder->newQuery();
                        call_user_func_array($columnDef['method'], [$whereQuery, $this->request->keyword()]);
                        $queryBuilder->addNestedWhereQuery($whereQuery, 'or');
                    } else {
                        $this->compileColumnQuery(
                                $queryBuilder, Helper::getOrMethod($columnDef['method']), $columnDef['parameters'], $columnName, $this->request->keyword()
                        );
                    }
                } else {
                    if (count(explode('.', $columnName)) > 1) {
                        $eagerLoads     = $this->getEagerLoads();
                        $parts          = explode('.', $columnName);
                        $relationColumn = array_pop($parts);
                        $relation       = implode('.', $parts);
                        if (in_array($relation, $eagerLoads)) {
                            $this->compileRelationSearch(
                                    $queryBuilder, $relation, $relationColumn, $globalKeyword
                            );
                        } else {
                            $this->compileGlobalSearch($queryBuilder, $columnName, $globalKeyword);
                        }
                    } else {
                        $this->compileGlobalSearch($queryBuilder, $columnName, $globalKeyword);
                    }
                }

                $this->isFilterApplied = true;
            }
        }
        );
    }
891919
protected function build_query() {
        global $DB;

        // Get the required tables and fields.
        $joins = array();
        $fields = array('q.hidden', 'q.category');
        foreach ($this->requiredcolumns as $column) {
            $extrajoins = $column->get_extra_joins();
            foreach ($extrajoins as $prefix => $join) {
                if (isset($joins[$prefix]) && $joins[$prefix] != $join) {
                    throw new \coding_exception('Join ' . $join . ' conflicts with previous join ' . $joins[$prefix]);
                }
                $joins[$prefix] = $join;
            }
            $fields = array_merge($fields, $column->get_required_fields());
        }
        $fields = array_unique($fields);

        // Build the order by clause.
        $sorts = array();
        foreach ($this->sort as $sort => $order) {
            list($colname, $subsort) = $this->parse_subsort($sort);
            $sorts[] = $this->requiredcolumns[$colname]->sort_expression($order < 0, $subsort);
        }

        // Build the where clause.
        $tests = array('q.parent = 0');
        $this->sqlparams = array();
        foreach ($this->searchconditions as $searchcondition) {
            if ($searchcondition->where()) {
                $tests[] = '((' . $searchcondition->where() .'))';
            }
            if ($searchcondition->params()) {
                $this->sqlparams = array_merge($this->sqlparams, $searchcondition->params());
            }
        }
        // Build the SQL.
        $sql = ' FROM {question} q ' . implode(' ', $joins);
        $sql .= ' WHERE ' . implode(' AND ', $tests);
        $this->countsql = 'SELECT count(1)' . $sql;
        $this->loadsql = 'SELECT ' . implode(', ', $fields) . $sql . ' ORDER BY ' . implode(', ', $sorts);
    }
225833
protected function createQuery()
    {
        if (!$this->queryCreated) {
            $this->setBaseQuery();
            $this->filter('fvIsApproved', 1);
            $this->setupAttributeFilters("left join FileSearchIndexAttributes on (fv.fID = FileSearchIndexAttributes.fID)");
            $this->setupFilePermissions();
            $this->setupFileSetFilters();
            $this->queryCreated = 1;
        }
    }
462797
public function buildQueryBuilder()
    {
        $builder = new QueryBuilder();

        foreach ($this->parsers as $parser) {
            if ($parser->wasApplied()) {
                $parser->apply($builder);
            }
        }

        foreach ($this->sorts as $sort) {
            $builder->orderBy($sort[0], $sort[1]);
        }

        if (!empty($this->perPage)) {
            $builder->setPageSize($this->perPage);
        }

        if (!empty($this->page)) {
            $builder->setPage($this->page);
        }

        if (!empty($this->searchQuery)) {
            $builder->setSearchQuery($this->searchQuery);
        }

        return $builder;
    }
488577
public function prefixQuery()
    {
        $options = $this->getOptions();
        
        if($this->validateOptions($options)) {
            
            if(array_key_exists('language' , $options)) {
               $this->language = $this->setLanguageCondition($options['language'], true);
            }
            
            $this->queryPrefix = $this->initQuery();
        }
        return $this;

    }
508301
public function search()
    {
        $query = static::find()->where(['and',
            ['is not', 'post_id', null],
            ['like', 'word', $this->query]
        ])->joinWith(['posts.author', 'posts.thread']);
        if (Podium::getInstance()->user->isGuest) {
            $query->joinWith(['posts.forum' => function($q) {
                $q->where([Forum::tableName() . '.visible' => 1]);
            }]);
        }
        $query->groupBy(['post_id', 'word_id']);

        $dataProvider = new ActiveDataProvider([
            'query' => $query,
            'sort' => [
                'defaultOrder' => ['thread_id' => SORT_DESC],
                'attributes' => [
                    'thread_id' => [
                        'asc' => ['thread_id' => SORT_ASC],
                        'desc' => ['thread_id' => SORT_DESC],
                        'default' => SORT_DESC,
                    ],
                ]
            ],
        ]);

        return $dataProvider;
    }
929212
public function useBoostQueriesFromTypoScript(): QueryBuilder
    {
        $searchConfiguration = $this->typoScriptConfiguration->getSearchConfiguration();

        if (!empty($searchConfiguration['query.']['boostQuery'])) {
            return $this->useBoostQueries($searchConfiguration['query.']['boostQuery']);
        }

        if (!empty($searchConfiguration['query.']['boostQuery.'])) {
            $boostQueries = $searchConfiguration['query.']['boostQuery.'];
            return $this->useBoostQueries(array_values($boostQueries));
        }

        return $this;
    }
294777
public function newQuery() {
        $factory = $this->factory;
        $factory->setServiceLocator($this->serviceLocator);
        return $factory->get($this->queryClassName)->setParent($this);
    }
154699
public function buildQuery()
    {
        $this->setSelectFrom();
        $this->setLeftJoins($this->qb);
        $this->setWhere($this->qb);
        $this->setWhereResultCallback($this->qb);
        $this->setWhereAllCallback($this->qb);
        $this->setOrderBy();
        $this->setLimit();

        return $this;
    }
589792
public function query()
    {
        $currentUser = $this->request->user($this->request->route('guard'));

        $query = $currentUser->isA('superadmin') ? app($this->model)->query() : app($this->model)->query()->whereIn('id', $currentUser->roles->pluck('id')->toArray());

        return $this->applyScopes($query);
    }
1025968
public function search($q = NULL, $settings = NULL)
    {

        if ($q) {

            $search = new Search($this, $q, $settings);

            if (!is_callback_function($settings)) {
                $search->boost($settings ? $settings : 1);
            }

            $search->build();

        }

        return $this;
    }
902269
public function useBoostFunctionFromTypoScript(): QueryBuilder
    {
        $searchConfiguration = $this->typoScriptConfiguration->getSearchConfiguration();
        if (!empty($searchConfiguration['query.']['boostFunction'])) {
            return $this->useBoostFunction($searchConfiguration['query.']['boostFunction']);
        }

        return $this;
    }
386079
protected function bindQuery()
    {
        $this->app->bind('iverberk.larasearch.query', function ($app, $params)
        {
            return new Query($params['proxy'], $params['term'], $params['options']);
        });
    }
897699
protected function carryOverIncompatibleQueries()
    {
        foreach ($this->filters['strata_relations'] as $queryType => $queryDetails) {
            if ($this->hasRelationQuery($queryType, 'AND') && $this->hasRelationQuery($queryType, 'OR')) {
                $this->andRelationToPostIn($queryType);
            }
        }

        return $this;
    }