Returns a list of available options optionally filtered by an sql $like statement ex: startswith%.

@param string $like
@param null|mixed $keywords
423365
public function getOptions($keywords = null)
    {
        if (!isset($this->attributeKey)) {
            return [];
        }

        if (!is_object($this->attributeKey->getAttributeKeySettings())) {
            return [];
        }

        if (!isset($this->akSelectOptionDisplayOrder)) {
            $this->load();
        }

        $type = $this->attributeKey->getAttributeKeySettings();

        $em = \Database::get()->getEntityManager();
        $r = $em->getRepository('\Concrete\Core\Entity\Attribute\Value\Value\SelectValueOption');
        $builder = $r->createQueryBuilder('v');
        $builder->where('v.list = :list');
        $builder->andWhere('v.isDeleted = false');
        if ($keywords) {
            $builder->andWhere($builder->expr()->like('v.value', ':value'));
            $builder->setParameter('value', $keywords . '%');
        }
        $builder->setParameter('list', $type->getOptionList());
        $options = [];
        switch ($this->akSelectOptionDisplayOrder) {
            case 'popularity_desc':
                $builder->addSelect('count(va.generic_value) as total');
                $builder->leftJoin('v.values', 'va');
                $builder->groupBy('v.avSelectOptionID');
                $builder->orderBy('total', 'desc');
                $r = $builder->getQuery()->getResult();
                foreach ($r as $option) {
                    $options[] = $option[0];
                }
                break;
            case 'alpha_asc':
                $builder->orderBy('v.value', 'asc');
                $options = $builder->getQuery()->getResult();
                break;
            default:
                $builder->orderBy('v.displayOrder', 'asc');
                $options = $builder->getQuery()->getResult();
                break;
        }

        return $options;
    }
626839
public function setMetaKeywords($keywords)
    {
        if (is_array($keywords)) {
            $keywords = implode(', ', $keywords);
        }

        return $this->addMeta(['name' => 'keywords', 'content' => e($keywords)]);
    }
753701
public static function getKeywordSuggestionsFromGoogle($keyword)
    {
        $data = self::curl('http://suggestqueries.google.com/complete/search?output=firefox&client=firefox&hl=en-US&q='.urlencode($keyword));
        if (($data = json_decode($data, true)) !== null && !empty($data[1])) {
            return $data[1];
        }

        return false;
    }
391530
public function query(string $keyword, string $categories, array $optional = [])
    {
        $params = [
            'query' => $keyword,
            'category' => $categories,
            'appid' => $this->app['config']['app_id'],
        ];

        return $this->httpPostJson('semantic/semproxy/search', array_merge($params, $optional));
    }
323941
public function search($keyword = "")
    {
        Yii::trace("Begin searching...", __METHOD__);
        $matches = $this->match($keyword);
        $results = [];
        foreach ($matches as $extension) {
            $results[$extension->extension->id()] = $extension->extension->search($keyword);
        }
        return $results;
    }
910183
public function scopeSearch($query, $keyword)
    {
        $columns = $this->searchColumns();

        foreach ($columns as $column) {

            if ($columns === reset($columns)) {

                $query->where($column, 'like', "%{$keyword}%");

            }

            $query->orWhere($column, 'like', "%{$keyword}%");
        }

        return $query;
    }
701043
private static function determineFilterLikeOrNotLike(array $filter, QueryBuilder $queryBuilder)
    {
        if (!\in_array($filter['operation'], ['LIKE', 'NOT LIKE'])) {
            return null;
        }

        return static::filterLikeOrNotLike($filter, $queryBuilder);
    }
426856
public function searchKeywords($keywords, $queryBuilder)
    {
        if ($this->attributeKey) {
            $result = $queryBuilder->expr()->like('ak_' . $this->attributeKey->getAttributeKeyHandle(), ':keywords');
        } else {
            $result = null;
        }

        return $result;
    }
1213042
protected function prepareKeyword($keyword)
    {
        if ($this->config->isCaseInsensitive()) {
            $keyword = Str::lower($keyword);
        }

        if ($this->config->isWildcard()) {
            $keyword = Helper::wildcardLikeString($keyword);
        }

        if ($this->config->isSmartSearch()) {
            $keyword = "%$keyword%";
        }

        return $keyword;
    }
742541
protected function filterOptionsBySearch($options, $query)
    {
        $filteredOptions = [];

        $optionMatchesSearch = function ($words, $option) {
            foreach ($words as $word) {
                $word = trim($word);
                if (!strlen($word)) {
                    continue;
                }

                if (!Str::contains(Str::lower($option), $word)) {
                    return false;
                }
            }

            return true;
        };

        /*
         * Exact
         */
        foreach ($options as $index => $option) {
            if (Str::is(Str::lower($option), $query)) {
                $filteredOptions[$index] = $option;
                unset($options[$index]);
            }
        }

        /*
         * Fuzzy
         */
        $words = explode(' ', $query);
        foreach ($options as $index => $option) {
            if ($optionMatchesSearch($words, $option)) {
                $filteredOptions[$index] = $option;
            }
        }

        return $filteredOptions;
    }
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]);
        }
    }
58527
public function getTables($like = null)
    {
        //Argument 1 must be a string or null
        Argument::i()->test(1, 'string', 'null');
        
        $query = $this->utility();
        $like = $like ? $this->bind($like) : null;
        $results = $this->query($query->showTables($like), $q->getBinds());
        $newResults = array();
        foreach ($results as $result) {
            foreach ($result as $key => $value) {
                $newResults[] = $value;
                break;
            }
        }
        
        return $newResults;
    }
708392
public function keywords($keywords = [])
    {
        $args = func_get_args();

        $this->mergeKeywords = (is_bool(end($args)) || is_int(end($args))) ? array_pop($args) : false;

        $keywords = is_array($keywords) ? $keywords : $args;

        array_walk($keywords, function (&$value) {
            $value = is_object($value) ? get_class($value) : $value;
        });

        $this->keywords = array_unique($keywords);

        return $this;
    }
506039
public function getcount($keyword){
		$keyword=mb_strtolower($keyword,'utf8');
		$db=BMySQL::getInstanceAndConnect();
		if(empty($db)){
			return NULL;
			}
		$qr='SELECT count(*) as cnt from `languages`';
		if(!empty($keyword)){
			$qr.=' where (lower(const) like '.$db->escapeString('%'.$keyword.'%').')or'.
				       '(lower(ru) like '.$db->escapeString('%'.$keyword.'%').')or'.
				       '(lower(ua) like '.$db->escapeString('%'.$keyword.'%').')';;
			
			}
		$q=$db->Query($qr);
		if(empty($q)){
			echo('<br>error!<br>'.$qr);
			return NULL;
			}
		$l=$db->fetch($q);
		return $l['cnt'];
		}
1102991
public function search($keyword = null, $startingIndex = 1)
    {
        // Handle if keyword is null or empty string
        if ($keyword === null || $keyword === '') {
            return false;
        }

        $url = 'https://www.googleapis.com/customsearch/v1?key=' . $this->apiKey .
               '&cx=' . $this->apiCx .
               '&q=' . urlencode($keyword) .
               '&hl=sv&siteSearchFilter=i&alt=json&start=' . $startingIndex;

        $results = $this->request($url);
        return $results;
    }
1100151
function getKeywords(keywords) {
  let arrs = [];

  utils._each(keywords, (v, k) => {
    if (utils.isArray(v)) {
      let values = [];
      utils._each(v, (val) => {
        val = utils.getValueString('keywords.' + k, val);
        if (val) { values.push(val); }
      });
      v = values;
    } else {
      v = utils.getValueString('keywords.' + k, v);
      if (utils.isStr(v)) {
        v = [v];
      } else {
        return;
      } // unsuported types - don't send a key
    }
    arrs.push({key: k, value: v});
  });

  return arrs;
}
132336
public function setKeywords(array $keywords)
    {
        foreach ($keywords as $query) {
            $keyword    = $query[0];
            $properties = (isset($query[1]) ? (array)$query[1] : null);
            $this->addKeyword($keyword, $properties);
        }

        return $this;
    }