Search

@param null $query
329238
public function search($query)
    {
        if ($this->hasSearch()) {

            $search = $this->search;

            // If it's a anonymous function
            if (!is_string($search) && is_callable($search)) {
                call_user_func($search, $this, $query);
            }
        }

        return $this;
    }
304436
public function search($query, $count = null)
    {
        $params = ['query' => [
            'q'     => $query,
            'count' => $count,
        ]];

        return $this->client->request(
            'GET',
            'users/search',
            $params
        );
    }
810814
protected function searchProfiles( $query )
    {
        $token = $this->getOAuthToken();
        if (!$token) return;

        $response = Unirest\Request::get(
            "https://pub.orcid.org/v1.2/search/orcid-bio/",
            [
                'Authorization' => "Bearer $token",
                'Content-Type' => 'application/orcid+json'
            ],
            # TODO: search in names only and use boosting
            [ 'q' => luceneQuery('text',$query) ]
        );

        if ($response->code == 200) {
            return $response->body->{'orcid-search-results'};
        }
    }
88852
public function search($query)
    {
        $this->logger->debug('Category:search:', [$query]);
        if (!Tools::isGoodString($query)) {
            $this->logger->error('Category::search: invalid query');
            return [];
        }
        $this->setGeneratorSearch($query, self::CATEGORY_NAMESPACE);
        return $this->getCategoryinfoResponse();
    }
105681
protected function extractResult($query)
    {
        $result = null;
        $i = 0;
        $hits                  = sizeof($query['hits']['hits']);
        $hit                   = $query['hits']['hits'];
        $result['searchfound'] = $hits;
        while ($i < $hits) {
            $result['result'][$i] = $query['hits']['hits'][$i]['_source'];
            
            $i++;
        }
        return $result;
    }
450746
protected function seek($where = null)
    {
        if ($where === null) {
            return $this->count;
        }

        $this->count = $where;

        return true;
    }
1274378
public function query($query, $params = array())
  {
    $results = $this->api->get($query, $params);
    if(!isset($results->errors)) {
      return $results;
    } else {
      return $this->debug_mode ? $results->errors[0]->message : null;
    }
  }
1020915
protected function validate($query)
    {
        if ($this->client->getIndex() == null) {
            throw new SearchException("Index cannot be null");
        }
        if ($this->client->getType() == null) {
            throw new SearchException("Type cannot be null");
        }
        if ($query == null) {
            throw new SearchException("Query can't be null");
        }
    }
698652
public static function search($query = '', $publickey = null, $secretkey = null)
    {
        return OmiseSearch::scope('charge', $publickey, $secretkey)->query($query);
    }
1227802
public function search($query) {
        $found = array();

        foreach ($this->settings as $setting) {
            if ($setting->is_related($query)) {
                $found[] = $setting;
            }
        }

        if ($found) {
            $result = new stdClass();
            $result->page     = $this;
            $result->settings = $found;
            return array($this->name => $result);
        }

        $found = false;
        if (strpos(strtolower($this->name), $query) !== false) {
            $found = true;
        } else if (strpos(core_text::strtolower($this->visiblename), $query) !== false) {
                $found = true;
            }
        if ($found) {
            $result = new stdClass();
            $result->page     = $this;
            $result->settings = array();
            return array($this->name => $result);
        } else {
            return array();
        }
    }
1185777
public function recommendedFor($query)
    {
        $requestOptions = [
            'scope' => 'pins',
            'query' => $query,
        ];

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

        return empty($result) ? [] : $this->getKeywordsFromRequest($result);
    }
155053
public function search($query, array $data)
    {
        $sql = 'SELECT si.entity_id';

        if (!empty($data['count'])) {
            $sql = 'SELECT COUNT(si.entity_id)';
        }

        $conditions = array($query, $data['language'], 'und', 'product');

        $sql .= ' FROM search_index si
                  LEFT JOIN product p ON(p.product_id = si.entity_id)
                  WHERE MATCH(si.text) AGAINST (? IN BOOLEAN MODE)
                  AND (si.language=? OR si.language=?)
                  AND si.entity=? AND p.product_id IS NOT NULL';

        if (isset($data['status'])) {
            $sql .= ' AND p.status=?';
            $conditions[] = (int) $data['status'];
        }

        if (isset($data['store_id'])) {
            $sql .= ' AND p.store_id=?';
            $conditions[] = (int) $data['store_id'];
        }

        if (empty($data['count'])) {
            $sql .= ' GROUP BY si.entity_id';
        }

        if (!empty($data['limit'])) {
            $sql .= ' LIMIT ' . implode(',', array_map('intval', $data['limit']));
        }

        if (!empty($data['count'])) {
            return $this->config->getDb()->fetchColumn($sql, $conditions);
        }

        $data['product_id'] = $this->config->getDb()->fetchColumnAll($sql, $conditions);

        if (empty($data['product_id'])) {
            return array();
        }

        unset($data['language']);
        return $this->product->getList($data);
    }
134501
public function parse($query=null)
    {
        $this->checkQuery($query);
        
        return $this->getDb()->setQuery($this->getQuery())->parse();
    }
36890
protected function checkQuery($query=null)
    {
        if ($query) {
            $this->getQuery()->set($query);
            unset($query);
        }
        
        $query = $this->getQuery();
        
        // if no table then set table
        if (!isset($query['table'])) {
            $query['table'] = $this->getTableName();
        }
        
        // use model database.table_prefix
        if (!isset($query['database']) && isset($this['database'])) {
            $query['database'] = $this['database'];
        }
        
        if (!isset($query['table_prefix']) && isset($this['table_prefix'])) {
            $query['table_prefix'] = $this['table_prefix'];
        }
        
        return static::formatQuery($query);
    }
331947
public function search($query = '', $options = null)
    {
        $this->setOptionsAndQuery($options, $query);

        $query = $this->getQuery();
        $path = $this->getPath();

        $params = $this->getOptions();

        // Send scroll_id via raw HTTP body to handle cases of very large (> 4kb) ids.
        if ('_search/scroll' == $path) {
            $data = [self::OPTION_SCROLL_ID => $params[self::OPTION_SCROLL_ID]];
            unset($params[self::OPTION_SCROLL_ID]);
        } else {
            $data = $query->toArray();
        }

        $response = $this->getClient()->request(
            $path,
            Request::GET,
            $data,
            $params
        );

        return $this->_builder->buildResultSet($response, $query);
    }
446407
public function userSearch($query)
    {
        $this->returnCode = 'no';

        return json_decode($this->send('v-search-user-object', $this->userName, $query, 'json'), true);
    }
147584
public function checkQuery($query = null)
  {
    if($query === null)
    {
      $query = $this->query;
    }

    if(strlen($query) == 0)
    {
      return TRUE;
    }

    $pattern = "/^" . $this->regex["uric"] . "*$/";
    $status = @preg_match($pattern, $query);

    if($status === FALSE)
    {
      throw new TeamSpeak3_Helper_Exception("URI query string validation failed");
    }

    return ($status == 1);
  }