@param string $search

@return array
499035
public function findByNameForAjax($search)
    {
        $resultArray = [];

        $users = $this->findByName($search);

        foreach ($users as $user) {
            $resultArray[] = [
                'id' => $user->getId(),
                'text' => $user->getFirstName().' '.$user->getLastName(),
            ];
        }

        return $resultArray;
    }
1079357
function after( string $search ) : SplString
    {
        if( $search === '' ){
            return $this;
        } else{
            return $this->setString( array_reverse( explode( $search, $this->__toString(), 2 ) )[0] );
        }
    }
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;
    }
470861
protected function _getSearchDataHeader(BaseSearch $search): array
    {
        $header = $search->getOptions();

        if ($search->hasIndices()) {
            $header['index'] = $search->getIndices();
        }

        if ($search->hasTypes()) {
            $header['types'] = $search->getTypes();
        }

        // Filter options accepted in the "header"
        return \array_intersect_key($header, \array_flip(self::$HEADER_OPTIONS));
    }
511763
public function searchUsers($search)
    {
        $users = $this->userRepository->findByName($search);

        return new JsonResponse(array_map(function (User $user) {
            return $this->userSerializer->serialize($user);
        }, $users));
    }
183586
public function search( $list, $search )
	{
		$lowbound	= 0;									// lowbound - untergrenze
		$highbound	= sizeof( $list ) - 1;					// highbound - obergrenze
		do
		{
			$index = $this->calculateIndex( $list, $search, $lowbound, $highbound );
//			echo "[".$lowbound."|".$highbound."]  search_index: ".$index.": ".$list[$index]."<br>";
			if( $index < $lowbound || $index > $highbound )
				return -1;
			if( $list[$index] == $search )
				return $index;
			if( $list[$index] < $search )
				$lowbound	= $index+1;
			else
				$highbound	= $index-1;
		}
		while( $lowbound < $highbound );
		return -1;
	}
520620
public static function search($query) {
    global $server;
    $response = $server->doCall('search', ['query' => $query]);
    $result = [];
    foreach ($response->getValue('list') as $item) {
      $result[] = ['type' => $item['type'], 'oid' => $item['oid'],
        'displayValue' => $item['displayValue'], 'summary' => $item['summary']
      ];
    }
    return ['return' => $result];
  }
656661
public function find_users($search) {
        global $CFG, $DB;

        $systemcontext = context_system::instance();
        $userids = get_users_by_capability($systemcontext, 'moodle/site:mnetlogintoremote', 'u.id');

        if (empty($userids)) {
            return array();
        }

        list($usql, $uparams) = $DB->get_in_or_equal(array_keys($userids), SQL_PARAMS_NAMED, 'uid');

        list($wherecondition, $params) = $this->search_sql($search, 'u');

        $params = array_merge($params, $uparams);
        $params['hostid'] = $this->hostid;
        $params['remotecourseid'] = $this->remotecourseid;
        $params['mnetlocalhostid'] = $CFG->mnet_localhost_id;

        $fields      = "SELECT ".$this->required_fields_sql("u");
        $countfields = "SELECT COUNT(1)";

        $sql = "          FROM {user} u
                         WHERE $wherecondition
                               AND u.mnethostid = :mnetlocalhostid
                               AND u.id $usql
                               AND u.id NOT IN (SELECT e.userid
                                                  FROM {mnetservice_enrol_enrolments} e
                                                 WHERE (e.hostid = :hostid AND e.remotecourseid = :remotecourseid))";

        list($sort, $sortparams) = users_order_by_sql('u');
        $order = "    ORDER BY $sort";

        if (!$this->is_validating()) {
            $potentialmemberscount = $DB->count_records_sql($countfields . $sql, $params);
            if ($potentialmemberscount > 100) {
                return $this->too_many_results($search, $potentialmemberscount);
            }
        }

        $availableusers = $DB->get_records_sql($fields . $sql . $order, array_merge($params, $sortparams));

        if (empty($availableusers)) {
            return array();
        }

        if ($search) {
            $groupname = get_string('enrolcandidatesmatching', 'enrol', $search);
        } else {
            $groupname = get_string('enrolcandidates', 'enrol');
        }

        return array($groupname => $availableusers);
    }
1205863
protected function initialise_javascript($search) {
        global $USER, $PAGE, $OUTPUT;
        $output = '';

        // Put the options into the session, to allow search.php to respond to the ajax requests.
        $options = $this->get_options();
        $hash = md5(serialize($options));
        $USER->userselectors[$hash] = $options;

        // Initialise the selector.
        $PAGE->requires->js_init_call(
            'M.core_user.init_user_selector',
            array($this->name, $hash, $this->extrafields, $search),
            false,
            self::$jsmodule
        );
        return $output;
    }
1193322
protected function getSearchCount($search, array $array)
    {
        $search = $this->getPregQuote($search);

        $number = 0;
        foreach ($array as $value) {
            if (preg_match('/^'.$search.'/', $value)) {
                $number++;
            }
        }

        return $number;
    }
97075
public function findDocuments(Search $search)
    {
        $results = $this->executeSearch($search);

        return new DocumentIterator(
            $results,
            $this->getManager(),
            $this->getScrollConfiguration($results, $search->getScroll())
        );
    }
112222
protected function parserSearchValue($search)
    {

        if (stripos($search, ';') || stripos($search, ':')) {
            $values = explode(';', $search);
            foreach ($values as $value) {
                $s = explode(':', $value);
                if (count($s) == 1) {
                    return $s[0];
                }
            }

            return null;
        }

        return $search;
    }
952013
public function findFirstUsersByName($search)
    {
        return $this->_em->createQueryBuilder()
            ->select(
                'u.id',
                "CONCAT(u.firstName, ' ', u.lastName, ' (', u.username, ')') AS name"
            )
            ->from('ClarolineCoreBundle:User', 'u')
            ->where('u.firstName LIKE :search')
            ->orWhere('u.lastName LIKE :search')
            ->orWhere('u.username LIKE :search')
            ->setMaxResults(5)
            ->setParameter(':search', "%{$search}%")
            ->getQuery()
            ->getArrayResult();
    }
1369102
protected function addAllFilter($search)
    {
        $this->builder = $this->builder->where(
            function ($query) use ($search) {
                foreach ($this->columns as $column) {
                    $query->orWhere(
                        new raw($this->getRawColumnQuery($column)),
                        'like',
                        '%' . $search . '%'
                    );
                }
            }
        );
    }
568618
public function search($search) {
        $search = trim($search);
        if (empty($search)) {
            return false;
        }
        $search_keys = $this->convertStrToH($search);
        //命中集合
        $hit_arr = array();
        $tree = &$this->nodeTree;
        $arr_len = count($search_keys);
        $current_index = 0;
        for ($i = 0; $i < $arr_len; $i++) {
            //若命中了一个索引 则继续向下寻找
            if (isset($tree[$search_keys[$i]])) {
                $node = $tree[$search_keys[$i]];
                if ($node['end']) {
                    //发现结尾 将原词以及自定义属性纳入返回结果集中 3.1 增加词频统计
                    $key = md5($node['full']);
                    if (isset($hit_arr[$key])) {
                        $hit_arr[$key]['count'] += 1;
                    } else {
                        $hit_arr[$key] = array(
                            'word' => $node['full'],
                            'data' => $node['data'],
                            'count' => 1
                        );
                    }
                    if (empty($node['child'])) {
                        //若不存在子集，检索游标还原
                        $i = $current_index;
                        //还原检索集合
                        $tree = &$this->nodeTree;
                        //字码游标下移
                        $current_index++;
                    } else {
                        //存在子集重定义检索tree
                        $tree = &$tree[$search_keys[$i]]['child'];
                    }
                    continue;
                } else {
                    //没发现结尾继续向下检索
                    $tree = &$tree[$search_keys[$i]]['child'];
                    continue;
                }
            } else {
                //还原检索起点
                $i = $current_index;
                //还原tree
                $tree = &$this->nodeTree;
                //字码位移
                $current_index++;
                continue;
            }
        }

        unset($tree, $search_keys);
        return $hit_arr;
    }
1312560
public function findOnPaymentDetails($search)
    {
        $qb = $this->getQueryBuilder()
            ->select('t')
            ->where('t.paymentDetails LIKE :search')
            ->setParameter('search', '%'.$search.'%');
         
        return $qb->getQuery()
            ->getOneOrNullResult();
    }
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;
    }