Builds the proper search syntax (query) for Landsat theia API
438355
def _query_builder(self,
                       start_date=None,
                       end_date=None,
                       clipper=None
                        ):
        
        search_string='format=json&lang=fr&q='
        if (start_date is not None):
            if(end_date is not None):
                search_string+='entre+'+start_date+'+et+'+end_date
            else:
                search_string+=start_date
        elif(end_date is not None): 
            search_string+=end_date
        
        if(clipper.query is not None):
            query=clipper.query.replace(' ','+')
            search_string+='+'+query
        if(clipper.bbox is not None):
            search_string+='&box='+clipper.bbox

        return search_string
655763
def query(options, collection_name,
          num_to_skip, num_to_return, query, field_selector=None):
    
    data = struct.pack("<I", options)
    data += bson._make_c_string(collection_name)
    data += struct.pack("<i", num_to_skip)
    data += struct.pack("<i", num_to_return)
    data += bson.BSON.encode(query)
    if field_selector is not None:
        data += bson.BSON.encode(field_selector)
    return __pack_message(2004, data)
655799
function prepare_select_query(self, types, search_opts, traits) {
	var ObjType, document_type, document_type_obj;
	return nr_fcall("nopg:prepare_select_query", function() {

		// If true then this is recursive function call
		var _recursive = false;
		if(is.obj(traits) && traits._recursive) {
			_recursive = traits._recursive;
		}

		//
		if( is.array(search_opts) && (search_opts.length === 1) && is_operator(search_opts[0]) ) {
			throw new TypeError('search_opts invalid: ' + util.inspect(search_opts) );
		}

		// Object type and document type
		if(is.array(types)) {
			types = [].concat(types);
			ObjType = types.shift();
			document_type = types.shift();
		} else {
			ObjType = types;
		}

		// Create the initial query object
		var q = new Query({
			'method': 'select',
			'ObjType': ObjType,
			'document_type': document_type
		});

		// Traits for search operation
		traits = parse_search_traits(traits);

		if(traits.hasOwnProperty('count')) {
			q.count(traits.count);
		}

		// Search options for documents
		search_opts = parse_search_opts(search_opts, traits);

		/* Build `type_condition` */

		// If we have the document_type we can limit the results with it
		if(document_type) {
			parse_where_type_condition(q, document_type);
		}

		/* Parse `opts_condition` */

		var type_predicate = search_opts ? _recursive_parse_predicates(ObjType, q, ((traits.match === 'any') ? 'OR' : 'AND'), traits, search_opts) : undefined;
		if(type_predicate) {
			q.where(type_predicate);
		}

		if(traits.limit) {
			q.limit(traits.limit);
		}

		if(traits.offset) {
			q.offset(traits.offset);
		}

		if(is.obj(document_type) && (document_type instanceof NoPg.Type) ) {
			document_type_obj = document_type;
		}

		return Q.fcall(function() {

			// Do not search type if recursive call
			if(_recursive) {
				return q;
			}

			// Do not search type again if we already have it
			if(document_type_obj) {
				return q;
			}

			// Do not search type if not a string
			if(!is.string(document_type)) {
				return q;
			}

			var order_enabled = (traits.order && has_property_names(traits.order)) ? true : false;
			var group_enabled = (traits.group && has_property_names(traits.group)) ? true : false;

			// Only search type if order has been enabled or traits.typeAwareness enabled
			if(!( group_enabled || order_enabled || traits.typeAwareness )) {
				return q;
			}

			return _get_type_by_name(self, document_type).then(function(type) {
				document_type_obj = type;
				return q;
			});

		}).then(function our_query(q) {

			if(traits.order) {
				q.orders( _parse_select_order(ObjType, document_type_obj, traits.order, q, traits) );
			}

			if(traits.group) {
				q.group( _parse_select_order(ObjType, document_type_obj, traits.group, q, traits) );
			}

			//debug.log('traits.typeAwareness = ', traits.typeAwareness);
			//if(document_type_obj) {
			//	debug.log('document_type_obj = ', document_type_obj);
			//	debug.log('document_type_obj.documents = ', document_type_obj.documents);
			//}

			if(traits.typeAwareness && document_type_obj && document_type_obj.hasOwnProperty('documents')) {
				// FIXME: Maybe we should make sure these documents settings do not collide?
				//debug.log('traits.documents = ', traits.documents);
				//debug.log('document_type_obj.documents = ', document_type_obj.documents);
				traits.documents = [].concat(traits.documents || []).concat(document_type_obj.documents);
				//debug.log('traits.documents = ', traits.documents);
			}

			// Fields to search for
			var fields = parse_select_fields(ObjType, traits);
			q.fields(fields);

			return q;
		});

	}); // nr_fcall
}
1075394
def search(cls, query, search_opts=None):
        

        if search_opts is None:
            search_opts = {}

        xmlrpc = XMLRPCConnection()
        try:
            search_result = xmlrpc.connection.search_tag(
                {
                    '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 xml_tag in search_result['result']:
            result['result'].append(Tag.from_dict(xml_tag))

        return result
780927
def query(cls, owner=None, name=None, offset=None, limit=None, api=None):
        
        api = api if api else cls._API
        query_params = {}
        if owner:
            url = cls._URL['query'].format(owner=owner)
        else:
            url = cls._URL['query'].format(owner='')
        if name:
            query_params['name'] = name
        return super(Project, cls)._query(
            url=url, offset=offset, limit=limit, fields='_all',
            api=api, **query_params
        )
1004993
def query_search_api(min_lat, max_lat, min_lon, max_lon, max_results):
    '''
    
    '''

    # Create URL
    params = urllib.urlencode(zip(
        ['client_id', 'bbox', 'per_page'],
        [CLIENT_ID, ','.join([str(min_lon), str(min_lat), str(
            max_lon), str(max_lat)]), str(max_results)]
    ))
    print(MAPILLARY_API_IM_SEARCH_URL + params)

    # Get data from server, then parse JSON
    query = urllib2.urlopen(MAPILLARY_API_IM_SEARCH_URL + params).read()
    query = json.loads(query)['features']

    print("Result: {0} images in area.".format(len(query)))
    return query
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)
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]
1136364
def query(options, collection_name, num_to_skip,
          num_to_return, query, field_selector, opts, check_keys=False):
    
    data = struct.pack("<I", options)
    data += bson._make_c_string(collection_name)
    data += struct.pack("<i", num_to_skip)
    data += struct.pack("<i", num_to_return)
    encoded = bson.BSON.encode(query, check_keys, opts)
    data += encoded
    max_bson_size = len(encoded)
    if field_selector is not None:
        encoded = bson.BSON.encode(field_selector, False, opts)
        data += encoded
        max_bson_size = max(len(encoded), max_bson_size)
    (request_id, query_message) = __pack_message(2004, data)
    return (request_id, query_message, max_bson_size)
1333399
def search(query)
      options = {:path => page_file_dir, :ref => ref}
      results = {}
      @repo.git.grep(query, options).each do |hit|
        name = hit[:name]
        count = hit[:count]
        # Remove ext only from known extensions.
        # test.pdf => test.pdf, test.md => test
        file_name = Page::valid_page_name?(name) ? name.chomp(::File.extname(name)) : name
        results[file_name] = count.to_i
      end

      # Use git ls-files '*query*' to search for file names. Grep only searches file content.
      # Spaces are converted to dashes when saving pages to disk.
      @repo.git.ls_files(query.gsub(' ','-'), options).each do |path|
        # Remove ext only from known extensions.
        file_name          = Page::valid_page_name?(path) ? path.chomp(::File.extname(path)) : path
        # If there's not already a result for file_name then
        # the value is nil and nil.to_i is 0.
        results[file_name] = results[file_name].to_i + 1;
      end

      results.map do |key, val|
        { :count => val, :name => key }
      end
    end
965317
def search(spec, operator='and'):
    
    field_map = {
        'name': 'name__icontains',
        'summary': 'releases__summary__icontains',
    }

    query_filter = None
    for field, values in spec.items():
        for value in values:
            if field not in field_map:
                continue

            field_filter = Q(**{field_map[field]: value})
            if not query_filter:
                query_filter = field_filter
                continue

            if operator == 'and':
                query_filter &= field_filter
            else:
                query_filter |= field_filter

    result = []
    packages = models.Package.objects.filter(query_filter).all()[:20]
    for package in packages:
        release = package.releases.all()[0]
        result.append({
            'name': package.name,
            'summary': release.summary,
            'version': release.version,
            '_pypi_ordering': 0,
        })
    return result
627994
def build(self, search, raw_query):
        
        unmatched_items = {}
        for expression, value in raw_query.items():
            # Parse query expression into tokens.
            tokens = expression.split(TOKEN_SEPARATOR)

            field = tokens[0]
            tail = tokens[1:]

            if field not in self.fields:
                unmatched_items[expression] = value
                continue

            # Map field alias to final field.
            field = self.fields_map.get(field, field)

            # Parse lookup expression. Currently only no token or a single token is allowed.
            if tail:
                if len(tail) > 1:
                    raise NotImplementedError("Nested lookup expressions are not supported")

                lookup = self.get_lookup(tail[0])
                search = lookup.apply(search, field, value)
            else:
                # Default lookup.
                custom_filter = getattr(self.custom_filter_object, 'custom_filter_{}'.format(field), None)
                if custom_filter is not None:
                    search = custom_filter(value, search)
                elif isinstance(value, list):
                    # Default is 'should' between matches. If you need anything else,
                    # a custom filter for this field should be implemented.
                    filters = [Q('match', **{field: item}) for item in value]
                    search = search.query('bool', should=filters)
                else:
                    search = search.query('match', **{field: {'query': value, 'operator': 'and'}})

        return (search, unmatched_items)
763853
def search(params)
      response = get("http://search.maven.org/solrsearch/select?", params.merge("rows" => "100", "wt" => "json"))
      json = JSON.parse(response.to_s)
      json["response"]["docs"]
    end
1138636
def search(self, query, options):
        
        query["query_format"] = "advanced"
        log.debug("Search query:")
        log.debug(pretty(query))
        # Fetch bug info
        try:
            result = self.server.query(query)
        except xmlrpclib.Fault as error:
            # Ignore non-existent users (this is necessary for users with
            # several email aliases to allow them using --merge/--total)
            if "not a valid username" in unicode(error):
                log.debug(error)
                return []
            # Otherwise suggest to bake bugzilla cookies
            log.error("An error encountered, while searching for bugs.")
            log.debug(error)
            raise ReportError(
                "Have you baked cookies using the 'bugzilla login' command?")
        log.debug("Search result:")
        log.debug(pretty(result))
        bugs = dict((bug.id, bug) for bug in result)
        # Fetch bug history
        log.debug("Fetching bug history")
        result = self.server._proxy.Bug.history({'ids': bugs.keys()})
        log.debug(pretty(result))
        history = dict((bug["id"], bug["history"]) for bug in result["bugs"])
        # Fetch bug comments
        log.debug("Fetching bug comments")
        result = self.server._proxy.Bug.comments({'ids': bugs.keys()})
        log.debug(pretty(result))
        comments = dict(
            (int(bug), data["comments"])
            for bug, data in result["bugs"].items())
        # Create bug objects
        return [
            self.parent.bug(
                bugs[id], history[id], comments[id], parent=self.parent)
            for id in bugs]
212418
function search (args) {
    // currently only raw mode is supported
    assert.ok(args.raw, 'elasticsearch only supports raw mode')
    // get raw mode property if set
    if (args.raw) {
        var raw = true
        // remove from args for elasticsearch
        delete args.raw
    }
    // get session if set
    if (args.session) {
        // not currently used
        delete args.session
    }
    // get elastic search client - throws error if no client
    var elasticsearchClient = this.elasticsearch()
    // do search
    return elasticsearchClient.search(args)
}
258636
def query(self, query, interpolations=None):
        
        return self._client.ts_query(self, query, interpolations)
1327422
def searchSuggestions(query,extras)
      method = 'searchSuggestions'
      type = TODO
      args = {:query=>query}
      args[:extras] = extras if extras
      return_object type,method,args
    end