https://developer.zendesk.com/rest_api/docs/core/search#list-search-results
973253
def search(self, query=None, **kwargs):
        ""
        api_path = "/api/v2/search.json"
        api_query = {}
        if "query" in kwargs.keys():
            api_query.update(kwargs["query"])
            del kwargs["query"]
        if query:
            api_query.update({
                "query": query,
            })
        return self.call(api_path, query=api_query, **kwargs)
1271291
def search(self, filterstr, attrlist):
        """"""
        return self._paged_search_ext_s(self.settings.BASE, ldap.SCOPE_SUBTREE, filterstr=filterstr,
                                        attrlist=attrlist, page_size=self.settings.PAGE_SIZE)
242328
def __get_search_results(self, url, limit, order_by, sort_order, filter):
        

        order_by_options = ['search_rank', 'series_id', 'title', 'units', 'frequency',
                            'seasonal_adjustment', 'realtime_start', 'realtime_end', 'last_updated',
                            'observation_start', 'observation_end', 'popularity']
        if order_by is not None:
            if order_by in order_by_options:
                url = url + '&order_by=' + order_by
            else:
                raise ValueError('%s is not in the valid list of order_by options: %s' % (order_by, str(order_by_options)))

        if filter is not None:
            if len(filter) == 2:
                url = url + '&filter_variable=%s&filter_value=%s' % (filter[0], filter[1])
            else:
                raise ValueError('Filter should be a 2 item tuple like (filter_variable, filter_value)')

        sort_order_options = ['asc', 'desc']
        if sort_order is not None:
            if sort_order in sort_order_options:
                url = url + '&sort_order=' + sort_order
            else:
                raise ValueError('%s is not in the valid list of sort_order options: %s' % (sort_order, str(sort_order_options)))

        data, num_results_total = self.__do_series_search(url)
        if data is None:
            return data

        if limit == 0:
            max_results_needed = num_results_total
        else:
            max_results_needed = limit

        if max_results_needed > self.max_results_per_request:
            for i in range(1, max_results_needed // self.max_results_per_request + 1):
                offset = i * self.max_results_per_request
                next_data, _ = self.__do_series_search(url + '&offset=' + str(offset))
                data = data.append(next_data)
        return data.head(max_results_needed)
516599
function list(options) {
  return function (req, res) {
    let list,
      listOptions = _.assign({
        prefix: req.uri,
        values: false
      }, options);

    list = db.list(listOptions);

    res.set('Content-Type', 'application/json');
    list.pipe(res);
  };
}
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
923720
def search(self, query, indices=None, doc_types=None, model=None, scan=False, headers=None, **query_params):
        
        if isinstance(query, Search):
            search = query
        elif isinstance(query, (Query, dict)):
            search = Search(query)
        else:
            raise InvalidQuery("search() must be supplied with a Search or Query object, or a dict")

        if scan:
            query_params.setdefault("search_type", "scan")
            query_params.setdefault("scroll", "10m")

        return ResultSet(self, search, indices=indices, doc_types=doc_types,
                         model=model, query_params=query_params, headers=headers)
1061799
def _list(self, uri, obj_class=None, body=None, return_raw=False,
            other_keys=None):
        
        if body:
            resp, resp_body = self.api.method_post(uri, body=body)
        else:
            resp, resp_body = self.api.method_get(uri)
        if return_raw:
            return (resp, resp_body)
        if obj_class is None:
            obj_class = self.resource_class

        data = self._data_from_response(resp_body)
        ret = [obj_class(self, res, loaded=False) for res in data if res]
        if other_keys:
            keys = utils.coerce_to_list(other_keys)
            other = [self._data_from_response(resp_body, key) for key in keys]
            return (ret, other)
        else:
            return ret
1094913
function querySearch (query) {
      var results = query ? self.vegetables.filter(createFilterFor(query)) : [];
      return results;
    }
444503
def search! query, operations = [], &block
      result = @agent_page.search query

      # FIXME on every object
      result = operations.reduce(result) do |tmp, op|
        tmp.__send__ op
      end if result

      yield result if block_given?

      result
    end
1214231
function querySearch( query, single, embed, callback ) {
    var embd = '';
        if ( single ) {
        for ( var key in embed ) {
            if (  embed.hasOwnProperty(key) ) {
                embd += '&embed[]=' + embed[key];
            }
        }
    }

    var url = apiBaseUrl + ( single ? endpoints['query']['single'] : endpoints['query']['multi'] ) + query + embd;

    fetch(url, function(result) {
        callback(result);
    });
}
325873
def google(rest):
	""
	API_URL = 'https://www.googleapis.com/customsearch/v1?'
	try:
		key = pmxbot.config['Google API key']
	except KeyError:
		return "Configure 'Google API key' in config"
	# Use a custom search that searches everything normally
	# http://stackoverflow.com/a/11206266/70170
	custom_search = '004862762669074674786:hddvfu0gyg0'
	params = dict(
		key=key,
		cx=custom_search,
		q=rest.strip(),
	)
	url = API_URL + urllib.parse.urlencode(params)
	resp = requests.get(url)
	resp.raise_for_status()
	results = resp.json()
	hit1 = next(iter(results['items']))
	return ' - '.join((
		urllib.parse.unquote(hit1['link']),
		hit1['title'],
	))
1148061
def list(self, search_opts=None):
        """"""
        query = base.get_query_string(search_opts)
        return self._list('/plugins%s' % query, 'plugins')
657360
function listItemsController(path) {
    restController.call(this, 'get', path);

    var ctrl = this;

    /**
     * Ignore empty by default on list controller
     * because parameters are most likly for search
     */
    ctrl.ignoreEmptyParams = true;

    /**
     * Method to paginate a mongoose query
     * @param {Integer} total
     * @param {Query} query
     * @param {Integer} [itemsPerPage=50]
     *
     * @return {Query}
     */
    this.paginate = function(total, query, itemsPerPage) {


        var paginate = require('node-paginate-anything');
        var p = paginate(ctrl.req, ctrl.res, total, itemsPerPage || 50);

        if (!p) {
            return query;
        }

        query.limit(p.limit);
        query.skip(p.skip);

        return query;
    };


    /**
     * List controller use this method to output a service as a rest
     * service
     *
     * This default method is paginated
     *
     * @param {apiService} service
     *
     * @return {Promise}
     */
    this.jsonService = function(service) {

        var params = ctrl.getServiceParameters(ctrl.req);

        var promise = service.getResultPromise(params, ctrl.paginate);

        ctrl.outputJsonFromPromise(service, promise);

        return promise;
    };
}
706127
def get_list(self, method="list", **kwargs):
        

        lg = logging.getLogger("%s.%s" % (self.ln, inspect.stack()[0][3]))
        lg.setLevel(self.log_level)

        args = inspect.getargvalues(inspect.currentframe())[3]
        lg.debug("\n****** Args *****:\n%s",
                 pp.pformat(args))

        es = kwargs.get("es",self.es)
        doc_type = get2(kwargs, "doc_type", self.doc_type)
        id_field = get2(kwargs, "id_field", "_id")
        value_fld = kwargs.get("value_fld")
        fields = kwargs.get("fields")
        sort_dir = get2(kwargs,"sort_dir", "asc")
        sort_fields = get2(kwargs,"sort_fields", get2(kwargs, "fields", [value_fld]))
        size = get2(kwargs,"size",2000)
        term = get2(kwargs,"term",'').replace("/","//")
        filter_field = kwargs.get('filter_field')
        filter_value = kwargs.get('filter_value')
        dsl = {}
        # set retutn to only return the fields specified or return the whole
        # document if not specified
        if fields is not None:
            dsl["_source"] = fields
        elif value_fld is not None:
            dsl["_source"] = [value_fld]
            fields = [value_fld]
        else:
            fields = []
        # set query parameters based on the return method "list" or "search"
        if sort_dir != "none" and method == "list":
            dsl["sort"] = []
            for fld in sort_fields:
                if fld is not None:
                    dsl["sort"].append({ fld: sort_dir })
        if method == "search":
            # query in elasticsearch breaks if the is a single open parenthesis
            # remove a single parenthesis from the search term
            if "(" in term and ")" not in term:
                search_term = term.replace("(", "")
            else:
                search_term = term
            size = 5
            dsl['query'] =  {
                "bool": {
                    "should": [
                        {
                            "query_string" : {
                                "analyze_wildcard": {
                                    "query": "*%s*" % search_term
                                }

                            }
                        },
                        {
                            "query_string" : {
                                "query": "*%s*" % search_term,
                                "analyzer": "default",
                                "analyze_wildcard": True,
                                "fields": fields,
                                "boost": 10
                            }
                        }
                    ]
                }
            }
        else:
            pass
        if filter_value:
            dsl['filter'] = {
                "term": { filter_field: filter_value }
            }
        lg.info("\n-------- size: %s\ndsl:\n%s", size, json.dumps(dsl,indent=4))
        result = es.search(index=self.es_index,
                           size=size,
                           doc_type=doc_type,
                           body=dsl)
        if kwargs.get("calc"):
            result = self._calc_result(result, kwargs['calc'])
        lg.debug(pp.pformat(result))
        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]
1370204
public JSONObject search(Query params, RequestOptions requestOptions) throws AlgoliaException {
    String paramsString = params.getQueryString();
    JSONObject body = new JSONObject();
    try {
      body.put("params", paramsString);
    } catch (JSONException e) {
      throw new RuntimeException(e);
    }
    return client.postRequest("/1/indexes/" + encodedIndexName + "/query", body.toString(), false, true, requestOptions);
  }
164978
def search(query, model):
    
    query = query.strip()
    LOGGER.debug(query)
    sqs = SearchQuerySet()
    results = sqs.raw_search('{}*'.format(query)).models(model)
    if not results:
        results = sqs.raw_search('*{}'.format(query)).models(model)
    if not results:
        results = sqs.raw_search('*{}*'.format(query)).models(model)

    return [o.pk for o in results]