A simple search scope.

@param  object  $query
@param  string  $searchTerm
@param  string  $taxonomy
@return mixed
333423
public function scopeSearch($query, $searchTerm, $taxonomy = 'major')
    {
        return $query->whereHas('term', function($q) use($searchTerm, $taxonomy) {
            $q->where('name', 'like', '%'. $searchTerm .'%');
        });
    }
1076673
public function search($query) {
        global $CFG;
        if ($result = parent::search($query)) {
            return $result;
        }

        $found = false;
        $repositories= core_component::get_plugin_list('repository');
        foreach ($repositories as $p => $dir) {
            if (strpos($p, $query) !== false) {
                $found = true;
                break;
            }
        }
        if (!$found) {
            foreach (repository::get_types() as $instance) {
                $title = $instance->get_typename();
                if (strpos(core_text::strtolower($title), $query) !== false) {
                    $found = true;
                    break;
                }
            }
        }

        if ($found) {
            $result = new stdClass();
            $result->page     = $this;
            $result->settings = array();
            return array($this->name => $result);
        } else {
            return array();
        }
    }
1107914
protected function execSearchRequest($query, $scope)
    {
        $url = $this->getResponse()->hasBookmarks() ?
            UrlBuilder::RESOURCE_SEARCH_WITH_PAGINATION :
            UrlBuilder::RESOURCE_SEARCH;

        $requestOptions = [
            'scope' => $scope,
            'query' => $query,
        ];

        $this->get($url, $requestOptions);

        return new SearchResponse(
            $this->getResponse()->getRawData()
        );
    }
752060
public function parseSearch($query, $type='default') {
		// if there's a colon in the search, assume that the user is doing a custom power search
		if (strpos($query, ':')) {
			return $query;
		}

		if (isset($this->queryBuilders[$type])) {
			return $this->queryBuilders[$type]->parse($query);
		}

		$lucene = implode(':' . $query . ' OR ', self::$default_query_fields) . ':' . $query;
		return $lucene;
	}
1225959
public function search($query) {
        global $CFG;
        if ($result = parent::search($query)) {
            return $result;
        }

        $found = false;
        $portfolios = core_component::get_plugin_list('portfolio');
        foreach ($portfolios as $p => $dir) {
            if (strpos($p, $query) !== false) {
                $found = true;
                break;
            }
        }
        if (!$found) {
            foreach (portfolio_instances(false, false) as $instance) {
                $title = $instance->get('name');
                if (strpos(core_text::strtolower($title), $query) !== false) {
                    $found = true;
                    break;
                }
            }
        }

        if ($found) {
            $result = new stdClass();
            $result->page     = $this;
            $result->settings = array();
            return array($this->name => $result);
        } else {
            return array();
        }
    }
1111348
protected function applySearchToQuery($query, $columns, $boolean = 'and')
    {
        $term = $this->searchTerm;

        if ($scopeMethod = $this->searchScope) {
            $searchMethod = $boolean == 'and' ? 'where' : 'orWhere';
            $query->$searchMethod(function ($q) use ($term, $columns, $scopeMethod) {
                $q->$scopeMethod($term, $columns);
            });
        }
        else {
            $searchMethod = $boolean == 'and' ? 'searchWhere' : 'orSearchWhere';
            $query->$searchMethod($term, $columns, $this->searchMode);
        }
    }
929709
protected function search(Builder $query, Request $request): Builder
    {
        $phrase = $request->input('q');

        if (!$phrase || strlen($phrase) < $this->minimumSearchInputLength) {
            return $query;
        }

        if ($this->translationModel()) {
            return $this->searchQueryTranslations($query, $phrase);
        }

        return $this->searchQuery($query, $phrase);
    }
1185777
public function recommendedFor($query)
    {
        $requestOptions = [
            'scope' => 'pins',
            'query' => $query,
        ];

        $result = $this->get(UrlBuilder::RESOURCE_SEARCH, $requestOptions);

        return empty($result) ? [] : $this->getKeywordsFromRequest($result);
    }
1291066
public function search($query)
    {
        try {
            $request = $this->client->createRequest($query);
            $response = $this->executeRequest($request);
            $this->hasSearched = true;
            $this->responseCache = $response;
        } catch (HttpException $e) {
            $this->handleErrorResponses($e);
        }
        return $response;
    }
1138872
public function createSearch($query = '', $options = null): Search
    {
        return $this->getType()->createSearch($query, $options);
    }
1280990
public function searchByQuery($query, $options = [])
    {
        $options = array_merge(['query' => $query], $options);

        return App::make('iverberk.larasearch.query', ['proxy' => $this, 'term' => null, 'options' => $options])->execute();
    }
1196804
public function scopeSearch($query, $request)
    {
        if (! empty($request->s)) {
            $query->where('first_name', 'like', '%' . $request->s . '%')
                    ->orWhere('last_name', 'like', '%' . $request->s . '%')
                    ->orWhere('email', 'like', '%' . $request->s . '%')
                    ->orWhere('phone', 'like', '%' . $request->s . '%');
        }

        if (isset($request->status) && $request->status === 'trashed') {
            $query->onlyTrashed();
        }

        return $query;
    }
1192706
public function scope(Query $query, $bundle = null)
    {
        $whereClause = $query->clause('where');
        if (!$whereClause) {
            return $query;
        }

        $whereClause->traverse(function (&$expression) use ($bundle, $query) {
            if ($expression instanceof ExpressionInterface) {
                $expression = $this->_inspectExpression($expression, $bundle, $query);
            }
        });

        return $query;
    }
550907
private static function applySearch(&$query, $search)
    {
        foreach ($search as $name => $filters) {
            foreach ($filters as $filter) {
                self::applySearchFilter($query, $filter);
            }
        }
    }
596085
public function scopeSearchFilter($query, $q)
    {
        if(!empty($q)){
            return $query->where(DB::raw('LOWER(name)'), 'LIKE', '%' . strtolower($q) . '%');
        }
    }
92085
public function scopeFullTextSearchFilter($query, $q, $user_id)
    {
        if(!empty($q)){

            // fall back to basic search if $q is a single word
            if(!strpos($q, ' ')){
                return $this->scopeSearchFilter($query, $q);
            }


            return $query->whereRaw('id IN (
            		SELECT id FROM dids 
            		WHERE searchable @@ plainto_tsquery(?) AND user_id = ?)',
                [$q, $user_id]
            );
        }
    }
1156928
private function doSettlementSearch($query)
    {
        $search = ClassValidator::getInstance('Eway\Rapid\Model\SettlementSearch', $query);
        return $this->getHttpService()->getSettlementSearch($search->toArray());
    }