Get inflections by searching in a specific column.

@param string $search String to search
@param string $column Column name

@return Inflection[] Search results
170804
private function getBy($search, $column)
    {
        $search = mb_strtolower($search, mb_detect_encoding($search));
        $this->procBuilder->setArguments(['-e', "\t$search\t"]);
        $process = $this->procBuilder->getProcess();
        $process->run();
        $csv = Csv\Reader::createFromString($process->getOutput());
        $csv->setDelimiter($this->delimiter);
        $results = [];
        foreach ($csv->fetchAssoc(['id', 'inflection', 'lemma', 'tags']) as $row) {
            if ($row[$column] == $search) {
                $results[] = new Inflection($row['id'], $row['inflection'], $row['lemma'], explode(' ', $row['tags']));
            }
        }

        return $results;
    }
458030
protected function getSearchQueriesForColumn(Builder $query, $column, $relevance, array $words)
    {
        $queries = [];

        $queries[] = $this->getSearchQuery($query, $column, $relevance, $words, 15);
        $queries[] = $this->getSearchQuery($query, $column, $relevance, $words, 5, '', '%');
        $queries[] = $this->getSearchQuery($query, $column, $relevance, $words, 1, '%', '%');

        return $queries;
    }
279692
protected function regexColumnSearch($column, $keyword, $caseSensitive = true)
    {
        if ($this->isOracleSql()) {
            $sql = $caseSensitive ? 'REGEXP_LIKE( ' . $column . ' , ? )' : 'REGEXP_LIKE( LOWER(' . $column . ') , ?, \'i\' )';
            $this->query->whereRaw($sql, [$keyword]);
        } else {
            $sql = $caseSensitive ? $column . ' like ?' : 'LOWER(' . $column . ') like ?';
            $this->query->whereRaw($sql, [Str::lower($keyword)]);
        }
    }
63243
private function _hasFilterExecuteForCyrillicColumn(string $search, string $column): bool
    {
        if (!preg_match("/[\w]+/i", $search) && \Assurrussa\GridView\Enums\FilterEnum::hasFilterExecuteForCyrillicColumn($column)) {
            return true;
        }

        return false;
    }
935095
static public function fuzzyMatch($search, $check, $caseInsensitive = true) {
        if ($caseInsensitive) {
            $search = strtolower($search);
            $check = strtolower($check);
        }
        $last_pos = 0;
        for ($j = 0, $l = strlen($search); $j < $l; ++$j) {
            $c = $search[$j];
            $p = strpos($check, $c, $last_pos);
            if (false === $p) {
                return false;
            }
            $last_pos = $p;
        }
        return true;
    }
578343
public function find_users($search) {
        list($wherecondition, $params) = $this->search_sql($search, 'u');

        list($sort, $sortparams) = users_order_by_sql('u', $search, $this->accesscontext);

        $roles = groups_get_members_by_role($this->groupid, $this->courseid,
                $this->required_fields_sql('u') . ', gm.component',
                $sort, $wherecondition, array_merge($params, $sortparams));

        return $this->convert_array_format($roles, $search);
    }
693289
protected function compileGlobalSearch($query, $column, $keyword)
    {

        if ($this->isSmartSearch()) {
            $column = $this->castColumn($column);
            $sql    = $column . ' LIKE ?';
            if ($this->isCaseInsensitive()) {
                $sql     = 'LOWER(' . $column . ') LIKE ?';
                $keyword = Str::lower($keyword);
            }

            $query->orWhereRaw($sql, [$keyword]);
        } else { // exact match
            $query->orWhereRaw("$column like ?", [$keyword]);
        }
    }
157168
public function search(array $search, $sort, $select = null)
    {
        $select = ($select) ?: $this->getSelect();

        foreach ($search as $key => $value) {
            if (!$value['searchString'] == '') {
                if (substr($value['searchString'], 0, 1) == '=' && $key == 0) {
                    $id = (int)substr($value['searchString'], 1);
                    $select->where->equalTo($this->getPrimaryKey(), $id);
                } else {
                    $where = $select->where->nest();
                    $c = 0;

                    foreach ($value['columns'] as $column) {
                        if ($c > 0) $where->or;
                        $where->like($column, '%' . $value['searchString'] . '%');
                        $c++;
                    }

                    $where->unnest();
                }
            }
        }

        $select = $this->setSortOrder($select, $sort);

        return $this->fetchResult($select);
    }
35966
public function getBlockedWords($search = ''){
        $where = array();
        if(!empty($search)){
            $where['word'] = array('LIKE', '%'.$search.'%');
        }
        $this->blockedWords = $this->db->selectAll($this->getBannedWordsTable(), $where);
        return $this->blockedWords;
    }
742766
public static function generateSearchQuery( $columns, $searchTerms ) {

		$searchTerms	= preg_split( '/,/', $searchTerms );
		$searchQuery	= "";

		// Multiple columns
		if( is_array( $columns ) ) {

			foreach( $columns as $ckey => $column ) {

				$query	= null;

				foreach( $searchTerms as $skey => $term ) {

					if( $skey  == 0 ) {

						$query = " $column like '%$term%' ";
					}
					else {

						$query .= " OR $column like '%$term%' ";
					}
				}

				if( isset( $query ) ) {

					if( $ckey  == 0 ) {

						$searchQuery =	"( $query )";
					}
					else {

						$searchQuery .= " OR ( $query )";
					}
				}
			}
		}
		// Single column
		else {

			foreach( $searchTerms as $key => $value ) {

				if( $key  == 0 ) {

					$searchQuery .= " $columns like '%$value%' ";
				}
				else {

					$searchQuery .= " OR $columns like '%$value%' ";
				}
			}
		}

		return $searchQuery;
	}
1027138
public function search($pattern = null)
    {
        if (! $pattern) {
            return;
        }

        foreach ($this->searchable as $column) {
            $this->resolveSearch($column, $pattern);
        }
    }
801993
public function getColumnForeignKeys($column)
    {
        $matches = [];
        foreach ($this->foreignKeys as $fk) {
            if (in_array($column, $fk->getLocalColumns())) {
                $matches[] = $fk;
            }
        }

        return $matches;
    }
128032
protected function compileRelationSearch($query, $relation, $column, $keyword)
    {
        $myQuery = clone $this->query;
        $myQuery->orWhereHas($relation, function ($q) use ($column, $keyword, $query) {
            $sql = $q->select($this->connection->raw('count(1)'))
                    ->where($column, 'like', $keyword)
                    ->toSql();
            $sql = "($sql) >= 1";
            $query->orWhereRaw($sql, [$keyword]);
        });
    }
275909
public function TagSearch($Search) {
      $Search = trim(str_replace(array('%', '_'), array('\%', '\_'), $Search));
      
      $Results = $this->SQL
         ->Select('UserID', '', 'id')
         ->Select('Name', '', 'name')
         ->From('User')
         ->Like('Name', $Search, 'right')
         ->Where('Deleted', 0)
         ->Limit(10)
         ->Get()->ResultArray();
      return $Results;
   }
231813
private function extractSearchTerms(string $query): array
    {
        $search_terms = [];

        // Words in double quotes stay together
        while (preg_match('/"([^"]+)"/', $query, $match)) {
            $search_terms[] = trim($match[1]);
            $query          = str_replace($match[0], '', $query);
        }

        // Other words get treated separately
        while (preg_match('/[\S]+/', $query, $match)) {
            $search_terms[] = trim($match[0]);
            $query          = str_replace($match[0], '', $query);
        }

        return $search_terms;
    }
333691
protected static function applyFilter($query, $column, $searchValue)
    {
        if ($methodName = self::hasCustomSearch($column)) {
            return self::$class::$methodName($query, $searchValue);
        }

        if (isRelationColumn($column)) {
            return self::applyRelationFilter($query, $column, $searchValue);
        }

        $searchValue = '%'.$searchValue.'%';

        return $query->orWhere($column, 'like', "$searchValue");
    }
141368
public function like($column, $pattern)
    {
        $this->conditions = [$this->grammar->buildId($column) . ' LIKE ' . $pattern];

        return $this;
    }