// CreateSearchParam converts a singular string query value (e.g. "2012") into
// a SearchParam object corresponding to the SearchParamInfo.
960955
func (s SearchParamInfo) CreateSearchParam(paramStr string) SearchParam {
	if ors := escapeFriendlySplit(paramStr, ','); len(ors) > 1 {
		return ParseOrParam(ors, s)
	}

	switch s.Type {
	case "composite":
		return ParseCompositeParam(paramStr, s)
	case "date":
		return ParseDateParam(paramStr, s)
	case "number":
		return ParseNumberParam(paramStr, s)
	case "quantity":
		return ParseQuantityParam(paramStr, s)
	case "reference":
		return ParseReferenceParam(paramStr, s)
	case "string":
		return ParseStringParam(paramStr, s)
	case "token":
		return ParseTokenParam(paramStr, s)
	case "uri":
		return ParseURIParam(paramStr, s)
	default:
		// Check for a custom search parameter
		if parser, err := GlobalRegistry().LookupParameterParser(s.Type); err == nil {
			data := SearchParamData{
				Modifier: s.Modifier,
				Chain:    s.Postfix,
				Prefix:   s.Prefix,
				Value:    paramStr,
			}
			param, err := parser(s, data)
			if err != nil {
				panic(createInternalServerError("MSG_PARAM_INVALID", fmt.Sprintf("Parameter \"%s\" content is invalid", s.Name)))
			}
			return param
		}
	}
	return nil
}
928053
func ParseOrParam(paramStr []string, info SearchParamInfo) *OrParam {
	ors := make([]SearchParam, len(paramStr))
	for i := range paramStr {
		ors[i] = info.CreateSearchParam(paramStr[i])
	}
	return &OrParam{SearchParamInfo{Name: info.Name, Type: "or"}, ors}
}
935769
func generateSQLSearchInfo(keywords searchKeyword) (sqlParameter string) {
	numberStr := strings.Join(keywords.number, " & ")
	wordStr := strings.Join(keywords.words, " & ")
	var fragments []string
	for _, v := range []string{numberStr, wordStr} {
		if v != "" {
			fragments = append(fragments, v)
		}
	}
	searchStr := strings.Join(fragments, " & ")
	return searchStr
}
436893
func (s *ServiceOfferingService) NewCreateServiceOfferingParams(displaytext string, name string) *CreateServiceOfferingParams {
	p := &CreateServiceOfferingParams{}
	p.p = make(map[string]interface{})
	p.p["displaytext"] = displaytext
	p.p["name"] = name
	return p
}
838604
func (r *Request) MatchParam(key, value string) *Request {
	query := r.URLStruct.Query()
	query.Set(key, value)
	r.URLStruct.RawQuery = query.Encode()
	return r
}
567930
func (wc *WebhookContext) Param(s string) string {
	return wc.gin.Param(s)
}
816384
func (c *client) newParamMap(key string, value interface{}) map[string]string {
	ret := make(map[string]string, len(c.params)+1)
	for key, value := range c.params {
		ret[key] = value
	}
	jsonVal, _ := json.Marshal(value)
	ret[key] = string(jsonVal)
	return ret
}
1190160
func (w *WebService) QueryParameter(name, description string) *Parameter {
	return QueryParameter(name, description)
}
1093988
func (r *Resource) WithParameter(name string, value string) *Resource {
	parameter := url.Values{}
	parameter.Set(name, value)
	r.u.RawQuery = parameter.Encode()
	return r
}
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
}
5011
func (self *simplePBundle) IntQueryParameter(name string, def int64) int64 {
	raw, ok := self.Query(name)
	if !ok {
		return def
	}
	i, err := strconv.ParseInt(raw, 10, 64)
	if err != nil {
		return def
	}
	return i
}
1343711
func (r *Request) Param(name, value string) *Request {
	r.Use(url.Param(name, value))
	return r
}
475435
func (k *PublicKeysService) Create(uri *Hyperlink, uriParams M, requestParams interface{}) (key *Key, result *Result) {
	url, err := ExpandWithDefault(uri, &CurrentPublicKeyUrl, uriParams)
	if err != nil {
		return nil, &Result{Err: err}
	}

	result = k.client.post(url, requestParams, &key)
	return
}
1339402
func ParseStringParam(paramString string, info SearchParamInfo) *StringParam {
	return &StringParam{info, unescape(paramString)}
}
691096
func (r *request) SetQueryParam(name string, values ...string) error {
	if r.query == nil {
		r.query = make(url.Values)
	}
	r.query[name] = values
	return nil
}
780310
func (s *Search) QueryParams() *url.Values {

	if s.query == nil {
		s.query = NewQuery()
	}

	if s.Debug != "" {
		s.query.params.Set("debug", s.Debug)
		s.query.params.Set("indent", "true")
	}

	return s.query.params
}
883615
func NewParams() *Params {
	return &Params{
		insCost:        1,
		subCost:        1,
		delCost:        1,
		maxCost:        0,
		minScore:       0,
		bonusPrefix:    4,
		bonusScale:     .1,
		bonusThreshold: .7,
	}
}