https://developer.zendesk.com/rest_api/docs/core/requests#search-requests
171846
def requests_search(self, cc_id=None, organization_id=None, query=None, status=None, **kwargs):
        ""
        api_path = "/api/v2/requests/search.json"
        api_query = {}
        if "query" in kwargs.keys():
            api_query.update(kwargs["query"])
            del kwargs["query"]
        if cc_id:
            api_query.update({
                "cc_id": cc_id,
            })
        if organization_id:
            api_query.update({
                "organization_id": organization_id,
            })
        if query:
            api_query.update({
                "query": query,
            })
        if status:
            api_query.update({
                "status": status,
            })
        return self.call(api_path, query=api_query, **kwargs)
613274
def saved_searches(self):
        
        return bind_api(
            api=self,
            path='/saved_searches/list.json',
            payload_type='saved_search', payload_list=True,
            require_auth=True
        )
976210
def search_vip_request(self, search):
        
        uri = 'api/v3/vip-request/?%s' % urllib.urlencode({'search': search})

        return super(ApiVipRequest, self).get(uri)
338053
def search(self, event):
        """"""

        try:
            data, schema, user, client = self._get_args(event)
        except AttributeError:
            return

        # object_filter['$text'] = {'$search': str(data['search'])}
        if data.get('fulltext', False) is True:
            object_filter = {
                'name': {
                    '$regex': str(data['search']),
                    '$options': '$i'
                }
            }
        else:
            if isinstance(data['search'], dict):
                object_filter = data['search']
            else:
                object_filter = {}

        if 'fields' in data:
            fields = data['fields']
        else:
            fields = []

        skip = data.get('skip', 0)
        limit = data.get('limit', 0)
        sort = data.get('sort', None)
        # page = data.get('page', 0)
        # count = data.get('count', 0)
        #
        # if page > 0 and count > 0:
        #     skip = page * count
        #     limit = count

        if 'subscribe' in data:
            self.log('Subscription:', data['subscribe'], lvl=verbose)
            do_subscribe = data['subscribe'] is True
        else:
            do_subscribe = False

        object_list = []

        size = objectmodels[schema].count(object_filter)

        if size > WARNSIZE and (limit > 0 and limit > WARNSIZE):
            self.log("Getting a very long (", size, ") list of items for ", schema,
                     lvl=warn)

        opts = schemastore[schema].get('options', {})
        hidden = opts.get('hidden', [])

        self.log("object_filter: ", object_filter, ' Schema: ', schema,
                 "Fields: ", fields,
                 lvl=verbose)

        options = {}
        if skip > 0:
            options['skip'] = skip
        if limit > 0:
            options['limit'] = limit
        if sort is not None:
            options['sort'] = []
            for item in sort:
                key = item[0]
                direction = item[1]
                direction = ASCENDING if direction == 'asc' else DESCENDING
                options['sort'].append([key, direction])

        cursor = objectmodels[schema].find(object_filter, **options)

        for item in cursor:
            if not self._check_permissions(user, 'list', item):
                continue
            self.log("Search found item: ", item, lvl=verbose)

            try:
                list_item = {'uuid': item.uuid}
                if fields in ('*', ['*']):
                    item_fields = item.serializablefields()
                    for field in hidden:
                        item_fields.pop(field, None)
                    object_list.append(item_fields)
                else:
                    if 'name' in item._fields:
                        list_item['name'] = item.name

                    for field in fields:
                        if field in item._fields and field not in hidden:
                            list_item[field] = item._fields[field]
                        else:
                            list_item[field] = None

                    object_list.append(list_item)

                if do_subscribe:
                    self._add_subscription(item.uuid, event)
            except Exception as e:
                self.log("Faulty object or field: ", e, type(e),
                         item._fields, fields, lvl=error, exc=True)
        # self.log("Generated object search list: ", object_list)

        result = {
            'component': 'hfos.events.objectmanager',
            'action': 'search',
            'data': {
                'schema': schema,
                'list': object_list,
                'size': size
            }
        }

        self._respond(None, result, event)
70772
def get_requests_with_errors(self):
        
        data = self._es.search(body={
            "size": max_query_results,
            "query": {
                "filtered": {
                    "query": {
                        "match_all": {}
                    },
                    "filter": {
                        "exists": {
                            "field": "errmsg"
                        }
                    }
                }
            }
        })
        return GremlinTestResult(False, data)
1206286
def search(query, team=None):
    
    if team is None:
        team = _find_logged_in_team()

    if team is not None:
        session = _get_session(team)
        response = session.get("%s/api/search/" % get_registry_url(team), params=dict(q=query))
        print("* Packages in team %s" % team)
        packages = response.json()['packages']
        for pkg in packages:
            print(("%s:" % team) + ("%(owner)s/%(name)s" % pkg))
        if len(packages) == 0:
            print("(No results)")
        print("* Packages in public cloud")

    public_session = _get_session(None)
    response = public_session.get("%s/api/search/" % get_registry_url(None), params=dict(q=query))
    packages = response.json()['packages']
    for pkg in packages:
        print("%(owner)s/%(name)s" % pkg)
    if len(packages) == 0:
        print("(No results)")
290761
def _do_search(self):
        
        if self._results_cache is None:
            response = self.raw()
            results = self.to_python(response.get('hits', {}).get('hits', []))
            self._results_cache = DictSearchResults(
                self.type, response, results, None)
        return self._results_cache
709688
def search_users(self):
        
        return bind_api(
            api=self,
            path='/users/search.json',
            payload_type='user', payload_list=True,
            require_auth=True,
            allowed_param=['q', 'count', 'page']
        )
408924
def get_search_results(self, request, queryset, search_term):
        
        # Apply keyword searches.
        def construct_search(field_name):
            if field_name.startswith('^'):
                return "%s__istartswith" % field_name[1:]
            elif field_name.startswith('='):
                return "%s__iexact" % field_name[1:]
            elif field_name.startswith('@'):
                return "%s__search" % field_name[1:]
            else:
                return "%s__icontains" % field_name

        use_distinct = False
        if self.search_fields and search_term:
            orm_lookups = [construct_search(str(search_field))
                           for search_field in self.search_fields]
            for bit in search_term.split():
                or_queries = [models.Q(**{orm_lookup: bit})
                              for orm_lookup in orm_lookups]
                queryset = queryset.filter(reduce(operator.or_, or_queries))
            if not use_distinct:
                for search_spec in orm_lookups:
                    if lookup_needs_distinct(self.opts, search_spec):
                        use_distinct = True
                        break

        return queryset, use_distinct
176094
function search(req, res, next) {
  var projectForms = req.appformsResultPayload.data || [];
  //Only Want The Project Ids
  projectForms = _.map(projectForms, function(form) {
    if (_.isObject(form)) {
      return form._id;
    } else {
      return form;
    }
  });

  var formsToFind = req.body || [];

  formsToFind = _.filter(projectForms, function(projFormId) {
    return formsToFind.indexOf(projFormId) > -1;
  });

  logger.debug("Middleware: search forms: ", {connection: req.connectionOptions, projectForms: projectForms});

  forms.findForms(req.connectionOptions, formsToFind, function(err, formsList) {
    if (err) {
      return next(err);
    }

    async.map(formsList, function(foundForm, cb) {
      var getParams = {
        "_id": foundForm._id,
        "showAdminFields": false
      };
      forms.getForm(_.extend(_.clone(req.connectionOptions), getParams), cb);
    }, formsResultHandlers(constants.resultTypes.forms, req, next));
  });
}
1247895
def search(self, path, keyword, page=1, recursion=1, limit=1000, **kwargs):
        
        params = {'dir': path,
                  'recursion': recursion,
                  'key': keyword,
                  'page': page,
                  'num': limit}

        # url = 'http://pan.baidu.com/api/search'

        return self._request('search', 'search', extra_params=params, **kwargs)
1304510
function search(term = _noSearchTermError()) {
	const url = `${API}/devrant/search`;
	const params = {
		app: 3,
		term
	};

	return http
		.GET(url, params)
		.then(data => data.results);
}
255805
def search(self):  # pylint: disable=no-self-use
        
        logger.debug("Grafana search... %s", cherrypy.request.method)
        if cherrypy.request.method == 'OPTIONS':
            cherrypy.response.headers['Access-Control-Allow-Methods'] = 'GET,POST,PATCH,PUT,DELETE'
            cherrypy.response.headers['Access-Control-Allow-Headers'] = 'Content-Type,Authorization'
            cherrypy.response.headers['Access-Control-Allow-Origin'] = '*'
            cherrypy.request.handler = None
            return {}

        if getattr(cherrypy.request, 'json', None):
            logger.debug("Posted data: %s", cherrypy.request.json)

        logger.debug("Grafana search returns: %s", GRAFANA_TARGETS)
        return GRAFANA_TARGETS
1099017
def _search(self, limit, format):
        '''
        
        '''
        url = self.QUERY_URL.format(requests.utils.quote("'{}'".format(self.query)), min(50, limit), self.current_offset, format)
        r = requests.get(url, auth=("", self.api_key))
        try:
            json_results = r.json()
        except ValueError as vE:
            if not self.safe:
                raise PyBingVideoException("Request returned with code %s, error msg: %s" % (r.status_code, r.text))
            else:
                print ("[ERROR] Request returned with code %s, error msg: %s. \nContinuing in 5 seconds." % (r.status_code, r.text))
                time.sleep(5)
        packaged_results = [VideoResult(single_result_json) for single_result_json in json_results['d']['results']]
        self.current_offset += min(50, limit, len(packaged_results))
        return packaged_results
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
901584
def settlement_search(search_request)
      unless @is_valid
        return make_response_with_exception(Exceptions::APIKeyInvalidException.new('API key, password or Rapid endpoint missing or invalid'), QueryCustomerResponse)
      end
      begin

        request = Message::TransactionProcess::SettlementSearchMsgProcess.create_request(search_request)
        url = @web_url + Constants::SETTLEMENT_SEARCH_METHOD +  request

        response = Message::TransactionProcess::SettlementSearchMsgProcess.send_request(url, @api_key, @password, @version)
        Message::TransactionProcess::SettlementSearchMsgProcess.make_result(response)

      rescue => e
        @logger.error(e.to_s) if @logger
        make_response_with_exception(e, SettlementSearchResponse)
      end
    end
1208384
def filter(cls, **items):
        '''
        
        '''
        client = cls._new_api_client(subpath='/search')
        items_dict = dict((k, v) for k, v in list(items.items()))
        json_data = json.dumps(items_dict, sort_keys=True, indent=4)
        return client.make_request(cls, 'post', post_data=json_data)