// Generates the query_params.go file which contains the main QueryParams
// struct used by Search and other methods.
765735
func main() {
	var (
		settings         []Option
		settingsTemplate = createTemplate("templates/query_params.go.tmpl")
		filepath         = "../../search/query_params.go"
	)

	for _, opt := range options {
		if isSearch(opt.Kind) {
			settings = append(settings, opt)
		}
	}

	generateFile(settingsTemplate, settings, filepath)
}
260162
func (r *Request) QueryParameter(name string) string {
	return r.Request.FormValue(name)
}
383821
func (raw *Raw) Query(endpoint string, out interface{}, q *QueryOptions) (*QueryMeta, error) {
	return raw.c.query(endpoint, out, q)
}
615124
func (f paramFiller) paramsStructMap(value map[string]interface{}, shape *Shape) string {
	out := f.typeName(shape) + "{\n"
	keys := util.SortedKeys(value)
	for _, k := range keys {
		v := value[k]
		out += fmt.Sprintf("%q: %s,\n", k, f.paramsStructAny(v, shape.ValueRef.Shape))
	}
	out += "}"
	return out
}
1169442
func QueryParameter(name, description string) *Parameter {
	p := &Parameter{&ParameterData{Name: name, Description: description, Required: false, DataType: "string", CollectionFormat: CollectionFormatCSV.String()}}
	p.beQuery()
	return p
}
294848
func Query(params map[string]string, buf *bytes.Buffer) ([]byte, bool) {
	l := len(params)
	if l == 0 {
		return emptyBytes, false
	}

	if l == 1 {
		for k, v := range params {
			return []byte(k + "=" + v), false
		}
	}

	var nbuf = buf
	if buf == nil {
		nbuf = bytes.NewBuffer(make([]byte, 0, Bufsize))
	}

	var i int
	for k, v := range params {
		if i != 0 {
			nbuf.WriteByte('&')
		}

		i++
		nbuf.WriteString(k)
		nbuf.WriteByte('=')
		nbuf.WriteString(v)
	}

	return nbuf.Bytes(), buf != nil
}
421748
func BuildURLFromMap(baseUrl string, queryParams map[string]string) string {
	if len(queryParams) < 1 {
		return baseUrl
	}
	queryValues := url.Values{}
	for key, val := range queryParams {
		queryValues.Set(key, val)
	}
	return BuildURL(baseUrl, queryValues)
}
197421
func Params(params map[string]interface{}) RequestOption {
	return func(req *http.Request) (*http.Request, error) {
		u := req.URL.String()
		req.URL = URLWithParams(u, params)
		return req, nil
	}
}
831996
func main() {

	// init a connection
	s, err := solr.Init("localhost", 8983, "collection-name")

	if err != nil {
		fmt.Println(err)
		return
	}

	// define a solr query string
	q := "q=*:*"

	// perform a query    
	res, err := s.SelectRaw(q)

	if err != nil {
		fmt.Println(err)
		return
	}

	// grab results for ease of use later on
	results := res.Results

	// print a summary and loop over results, priting the "title" and "latlng" fields
	fmt.Println(
		fmt.Sprintf("Query: %#v\nHits: %d\nNum Results: %d\nQtime: %d\nStatus: %d\n\nResults\n-------\n",
			q,
			results.NumFound,
			results.Len(),
			res.QTime,
			res.Status))

	for i := 0; i < results.Len(); i++ {
		fmt.Println("Some field:", results.Get(i).Field("id"))
		fmt.Println("Some other field:", results.Get(i).Field("title"))

		fmt.Println("")
	}

}
233389
func (gr *GoReq) queryStruct(content interface{}) *GoReq {
	if marshalContent, err := json.Marshal(content); err != nil {
		gr.Errors = append(gr.Errors, err)
	} else {
		var val map[string]interface{}
		if err := json.Unmarshal(marshalContent, &val); err != nil {
			gr.Errors = append(gr.Errors, err)
		} else {
			for k, v := range val {
				gr.QueryData.Add(k, v.(string))
			}
		}
	}
	return gr
}
1215623
func GetReqQueryParam(req *http.Request, headerName string) string {
	return strings.TrimSpace(req.URL.Query().Get(headerName))
}
466198
func (pq *ParsedQuery) GenerateQuery(bindVariables map[string]*querypb.BindVariable, extras map[string]Encodable) (string, error) {
	if len(pq.bindLocations) == 0 {
		return pq.Query, nil
	}
	var buf strings.Builder
	buf.Grow(len(pq.Query))
	if err := pq.Append(&buf, bindVariables, extras); err != nil {
		return "", err
	}
	return buf.String(), nil
}
460589
func AddQueryParameters(baseURL string, queryParams map[string]string) string {
	baseURL += "?"
	params := url.Values{}
	for key, value := range queryParams {
		params.Add(key, value)
	}
	return baseURL + params.Encode()
}
1101088
func (ctx *context) URLParams() map[string]string {
	values := map[string]string{}

	q := ctx.request.URL.Query()
	if q != nil {
		for k, v := range q {
			values[k] = strings.Join(v, ",")
		}
	}

	return values
}
510572
func (r *Request) QueryParameters(name string) []string {
	return r.Request.URL.Query()[name]
}
99672
func (o *QueryOptions) URLQueryParameters() URLQueryParameters {
	var queryParams URLQueryParameters
	if o.IsSTU3Sort {
		keys := make([]string, len(o.Sort))
		for i := range o.Sort {
			if o.Sort[i].Descending {
				keys[i] = fmt.Sprintf("-%s", o.Sort[i].Parameter.Name)
			} else {
				keys[i] = o.Sort[i].Parameter.Name
			}
		}
		queryParams.Add(SortParam, strings.Join(keys, ","))
	} else {
		for _, sort := range o.Sort {
			sortParamKey := SortParam
			if sort.Descending {
				sortParamKey += ":desc"
			}
			queryParams.Add(sortParamKey, sort.Parameter.Name)
		}
	}
	queryParams.Set(OffsetParam, strconv.Itoa(o.Offset))
	queryParams.Set(CountParam, strconv.Itoa(o.Count))
	for _, incl := range o.Include {
		queryParams.Add(IncludeParam, fmt.Sprintf("%s:%s", incl.Resource, incl.Parameter.Name))
	}
	for _, incl := range o.RevInclude {
		queryParams.Add(RevIncludeParam, fmt.Sprintf("%s:%s", incl.Resource, incl.Parameter.Name))
	}
	return queryParams
}
1219624
func Param(req *http.Request, paramName string) string {
	return req.URL.Query().Get(":" + paramName)
}