The actual query to safebrowsing api
        
        :param search_value: value to search for
        :type search_value: str
        :param search_type: 'url' or 'ip'
        :type search_type: str
        :return: Results
        :rtype: str
341928
def __query_safebrowsing(self, search_value, search_type):
        
        return json.loads(
                self.session.post(
                    self.url,
                    json=self.__prepare_body(
                        search_value=search_value,
                        search_type=search_type
                    )
                ).text
            )
221374
def search_url(*args)
      options = args.extract_options!.stringify_keys!
      protocol = (options.delete('protocol') || self.protocol).to_s
      
      uri = search_uri
      uri.scheme = protocol
      uri.query = ["key=#{api_key}", "q=#{URI.escape(args.join(','))}", *options.map{ |k,v| "#{k}=#{v}" }].join('&')
      p uri.to_s if self.debug
      return uri
    end
1364772
def search_simple(self, index,itype, key, search_term):
        '''
        
        '''
        request = self.session
        url = 'http://%s:%s/%s/%s/_search?q=%s:%s' % (self.host,self.port,index,itype,key,search_term)
        response = request.get(url)

        return response
596447
def url(self, value):
        

        if value is not None:
            assert type(value) is unicode, "'{0}' attribute: '{1}' type is not 'unicode'!".format(
                "url", value)
        self.__url = value
1123129
def search_raw(self, query, indices=None, doc_types=None, headers=None, **query_params):
        
        from .query import Search, Query

        if isinstance(query, Query):
            query = query.search()
        if isinstance(query, Search):
            query = query.serialize()
        body = self._encode_query(query)
        path = self._make_path(indices, doc_types, "_search")
        return self._send_request('GET', path, body, params=query_params, headers=headers)
418155
def _do_search(self):
        
        if self._results_cache is None:
            response = self.raw()
            ResultsClass = self.get_results_class()
            results = self.to_python(response.get('hits', {}).get('hits', []))
            self._results_cache = ResultsClass(
                self.type, response, results, self.fields)
        return self._results_cache
1289385
def _search(self, model, condition=None, search_field='name',
                value_field='id', label_field=None, pagination=True):
        
        from uliweb import json, request

        name = request.GET.get('term', '')
        M = functions.get_model(model)

        def _v(label_field):
            if label_field:
                return lambda x: getattr(x, label_field)
            else:
                return lambda x: unicode(x)

        v_field = request.values.get('label', 'title')
        page = int(request.values.get('page') or 1)
        limit = int(request.values.get('limit') or 10)
        v_func = _v(label_field)
        if name:
            if condition is None:
                condition = M.c[search_field].like('%' + name + '%')
            if pagination:
                query = M.filter(condition)
                total = query.count()
                rows = [{'id': getattr(obj, value_field), v_field: v_func(obj)}
                            for obj in query.limit(limit).offset((page-1)*limit)]
                result = {'total':total, 'rows':rows}
            else:
                result = [{'id': getattr(obj, value_field), v_field: v_func(obj)}
                      for obj in M.filter(condition)]
        else:
            result = []
        return json(result)
1108841
def search(cls, query, search_opts=None):
        

        if search_opts is None:
            search_opts = {}

        xmlrpc = XMLRPCConnection()
        try:
            search_result = xmlrpc.connection.search_pool(
                {
                    'query': query,
                    'search_options': search_opts,
                    'auth': AuthOptions().options
                })
        except xmlrpclib.Fault as xml_fault:
            raise _fault_to_exception(xml_fault)
        result = dict()
        result['result'] = []
        result['search_options'] = search_result['search_options']
        for pool in search_result['result']:
            p = Pool.from_dict(pool)
            result['result'].append(p)

        return result
1208031
def search_v2(self, q, resolve=True, result_type=None, account_id=None, offset=None, min_id=None, max_id=None):
        
        params = self.__generate_params(locals())
        
        if resolve == False:
            del params['resolve']
        
        if "result_type" in params:
            params["type"] = params["result_type"]
            del params["result_type"]
        
        return self.__api_request('GET', '/api/v2/search', params)
783459
def raw_query(query, index=INDEX_NAME, doc_type=DOC_TYPE):
    
    result = es_conn.search(index=index, doc_type=DOC_TYPE, body=query)
    return result['hits']['hits']
873210
def _get_search_result(self, query_url, **query_params):
        
        param_q = query_params.get('q')
        param_query = query_params.get('query')
        # Either q or query parameter is required
        if bool(param_q) == bool(param_query):
            raise CloudantArgumentError(104, query_params)

        # Validate query arguments and values
        for key, val in iteritems_(query_params):
            if key not in list(SEARCH_INDEX_ARGS.keys()):
                raise CloudantArgumentError(105, key)
            if not isinstance(val, SEARCH_INDEX_ARGS[key]):
                raise CloudantArgumentError(106, key, SEARCH_INDEX_ARGS[key])
        # Execute query search
        headers = {'Content-Type': 'application/json'}
        resp = self.r_session.post(
            query_url,
            headers=headers,
            data=json.dumps(query_params, cls=self.client.encoder)
        )
        resp.raise_for_status()
        return response_to_json_dict(resp)
1267669
def get_str(cls, result_type):
        
        if result_type == cls.ALARM:
            return "Alarm"
        elif result_type == cls.LOG:
            return "Log Message"
        elif result_type == cls.ERROR:
            return "Error Message"
        elif result_type == cls.HOST_DETAIL:
            return "Host Detail"
        else:
            assert False, "Erroneous result type {0}.".format(result_type)
298543
def search(self, search_content, search_type, limit=9):
        

        url = 'http://music.163.com/weapi/cloudsearch/get/web?csrf_token='
        params = {'s': search_content, 'type': search_type, 'offset': 0,
                  'sub': 'false', 'limit': limit}
        result = self.post_request(url, params)
        return result
1347612
def search(query, index=INDEX_NAME, doc_type=DOC_TYPE):
    
    results = raw_query(query, index=index, doc_type=doc_type)
    return [r['_source'] for r in results]
1349680
def searchproject(self, search, page=1, per_page=20):
        
        data = {'page': page, 'per_page': per_page}
        request = requests.get("{0}/{1}".format(self.search_url, search), params=data,
                               verify=self.verify_ssl, auth=self.auth, headers=self.headers, timeout=self.timeout)

        if request.status_code == 200:
            return request.json()
        else:
            return False
939052
def is_data_value(searchpath, searchtree, dtype = None, empty_is_false = False):
    
    if isinstance(searchpath, (str, unicode, int)):
        searchpath = [searchpath]

    if not isinstance(searchpath, (list, tuple)):
        return False

    for d in searchpath:
        if isinstance(searchtree, dict):
            if not d in searchtree.keys():
                return False

        elif isinstance(searchtree, (list, tuple)):
            if (not isinstance(d, int) or (d >= 0 and d >= len(searchtree)) or (d < 0 and -d > len(searchtree))):
                return False

        else:
            return False

        searchtree = searchtree[d]

    if dtype == None and not (empty_is_false and searchtree == None):
        return True

    if empty_is_false and searchtree in (None, "", {}, []):
        return False

    if isinstance(dtype, tuple):
        dtype = list(dtype)

    elif not isinstance(dtype, list):
        dtype = [dtype]

    if float in dtype and not int in dtype:
        dtype.append(int)

    if str in dtype or unicode in dtype or 'string' in dtype:
        for dtp in (str, unicode, 'string'):
            while dtp in dtype:
                dtype.remove(dtp)
        dtype.extend([str, unicode])

    if list in dtype or tuple in dtype or 'list' in dtype:
        for dtp in (list, tuple, 'list'):
            while dtp in dtype:
                dtype.remove(dtp)
        dtype.extend([list, tuple])

    dtype = tuple(dtype)

    return bool(isinstance(searchtree, dtype))
1211460
def search_info(self, search_index):
        
        ddoc_search_info = self.r_session.get(
            '/'.join([self.document_url, '_search_info', search_index]))
        ddoc_search_info.raise_for_status()
        return response_to_json_dict(ddoc_search_info)