// NewSuggesterGeoQuery creates a new SuggesterGeoQuery.
776930
func NewSuggesterGeoQuery(name string, location *GeoPoint) *SuggesterGeoQuery {
	return &SuggesterGeoQuery{
		name:      name,
		location:  location,
		precision: make([]string, 0),
	}
}
66508
func (q *SuggesterCategoryQuery) Source() interface{} {
	source := make(map[string]interface{})

	switch len(q.values) {
	case 0:
		source[q.name] = q.values
	case 1:
		source[q.name] = q.values[0]
	default:
		source[q.name] = q.values
	}

	return source
}
1316825
func (c *Client) NewSearchRequest(index, q string) *RpbSearchQueryReq {
	return &RpbSearchQueryReq{
		Q:     []byte(q),
		Index: []byte(index),
	}
}
918616
func NewSetCustomQuotaArg(UsersAndQuotas []*UserCustomQuotaArg) *SetCustomQuotaArg {
	s := new(SetCustomQuotaArg)
	s.UsersAndQuotas = UsersAndQuotas
	return s
}
691762
func NewFuzzyCompletionSuggester(name string) FuzzyCompletionSuggester {
	return FuzzyCompletionSuggester{
		name:           name,
		contextQueries: make([]SuggesterContextQuery, 0),
	}
}
1066074
func NewSetGpsGlobalOrigin(LATITUDE int32, LONGITUDE int32, ALTITUDE int32, TARGET_SYSTEM uint8) *SetGpsGlobalOrigin {
	m := SetGpsGlobalOrigin{}
	m.LATITUDE = LATITUDE
	m.LONGITUDE = LONGITUDE
	m.ALTITUDE = ALTITUDE
	m.TARGET_SYSTEM = TARGET_SYSTEM
	return &m
}
652670
func NewSetCookiesArgs(cookies []CookieParam) *SetCookiesArgs {
	args := new(SetCookiesArgs)
	args.Cookies = cookies
	return args
}
1063883
func NewSuggesterCategoryQuery(name string, values ...string) *SuggesterCategoryQuery {
	q := &SuggesterCategoryQuery{
		name:   name,
		values: make(map[string]*int),
	}

	if len(values) > 0 {
		q.Values(values...)
	}
	return q
}
227923
func NewGeoBoundingBoxQuery(topLeftLon, topLeftLat, bottomRightLon, bottomRightLat float64) *query.GeoBoundingBoxQuery {
	return query.NewGeoBoundingBoxQuery(topLeftLon, topLeftLat, bottomRightLon, bottomRightLat)
}
6780
func NewSigFilter(policyName string, support SigFilterSupport) *SigFilter {
	return &SigFilter{
		policyName: policyName,
		support:    support,
	}
}
245293
func (obj *Doc) SearchSuggest(ctx context.Context, options *SearchCombinationOptions, terms []string) (*SearchSuggestionResult, error) {
	result := &struct {
		Result *SearchSuggestionResult	`json:"qResult"`
	} {}
	err := obj.rpc(ctx, "SearchSuggest", result, options, terms)
	return result.Result, err 
}
162083
func (s *Suggester) SetDocumentSuggesterOptions(v *DocumentSuggesterOptions) *Suggester {
	s.DocumentSuggesterOptions = v
	return s
}
522530
func (q *PhraseSuggester) Source(includeName bool) (interface{}, error) {
	ps := &phraseSuggesterRequest{}

	if q.text != "" {
		ps.Text = q.text
	}

	suggester := make(map[string]interface{})
	ps.Phrase = suggester

	if q.analyzer != "" {
		suggester["analyzer"] = q.analyzer
	}
	if q.field != "" {
		suggester["field"] = q.field
	}
	if q.size != nil {
		suggester["size"] = *q.size
	}
	if q.shardSize != nil {
		suggester["shard_size"] = *q.shardSize
	}
	switch len(q.contextQueries) {
	case 0:
	case 1:
		src, err := q.contextQueries[0].Source()
		if err != nil {
			return nil, err
		}
		suggester["contexts"] = src
	default:
		var ctxq []interface{}
		for _, query := range q.contextQueries {
			src, err := query.Source()
			if err != nil {
				return nil, err
			}
			ctxq = append(ctxq, src)
		}
		suggester["contexts"] = ctxq
	}

	// Phase-specified parameters
	if q.realWordErrorLikelihood != nil {
		suggester["real_word_error_likelihood"] = *q.realWordErrorLikelihood
	}
	if q.confidence != nil {
		suggester["confidence"] = *q.confidence
	}
	if q.separator != nil {
		suggester["separator"] = *q.separator
	}
	if q.maxErrors != nil {
		suggester["max_errors"] = *q.maxErrors
	}
	if q.gramSize != nil {
		suggester["gram_size"] = *q.gramSize
	}
	if q.forceUnigrams != nil {
		suggester["force_unigrams"] = *q.forceUnigrams
	}
	if q.tokenLimit != nil {
		suggester["token_limit"] = *q.tokenLimit
	}
	if q.generators != nil && len(q.generators) > 0 {
		for typ, generators := range q.generators {
			var arr []interface{}
			for _, g := range generators {
				src, err := g.Source()
				if err != nil {
					return nil, err
				}
				arr = append(arr, src)
			}
			suggester[typ] = arr
		}
	}
	if q.smoothingModel != nil {
		src, err := q.smoothingModel.Source()
		if err != nil {
			return nil, err
		}
		x := make(map[string]interface{})
		x[q.smoothingModel.Type()] = src
		suggester["smoothing"] = x
	}
	if q.preTag != nil {
		hl := make(map[string]string)
		hl["pre_tag"] = *q.preTag
		if q.postTag != nil {
			hl["post_tag"] = *q.postTag
		}
		suggester["highlight"] = hl
	}
	if q.collateQuery != nil {
		collate := make(map[string]interface{})
		suggester["collate"] = collate
		if q.collateQuery != nil {
			src, err := q.collateQuery.Source()
			if err != nil {
				return nil, err
			}
			collate["query"] = src
		}
		if q.collatePreference != nil {
			collate["preference"] = *q.collatePreference
		}
		if len(q.collateParams) > 0 {
			collate["params"] = q.collateParams
		}
		if q.collatePrune != nil {
			collate["prune"] = *q.collatePrune
		}
	}

	if !includeName {
		return ps, nil
	}

	source := make(map[string]interface{})
	source[q.name] = ps
	return source, nil
}
921774
func NewSetCookieArgs(name string, value string) *SetCookieArgs {
	args := new(SetCookieArgs)
	args.Name = name
	args.Value = value
	return args
}
736521
func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {
	scopesOption := option.WithScopes(
		"https://www.googleapis.com/auth/userinfo.email",
	)
	// NOTE: prepend, so we don't override user-specified scopes.
	opts = append([]option.ClientOption{scopesOption}, opts...)
	client, endpoint, err := htransport.NewClient(ctx, opts...)
	if err != nil {
		return nil, err
	}
	s, err := New(client)
	if err != nil {
		return nil, err
	}
	if endpoint != "" {
		s.BasePath = endpoint
	}
	return s, nil
}
678878
func (s *DefineSuggesterInput) SetSuggester(v *Suggester) *DefineSuggesterInput {
	s.Suggester = v
	return s
}
926509
func NewSimpleQueryStringQuery(text string) *SimpleQueryStringQuery {
	return &SimpleQueryStringQuery{
		queryText:          text,
		fields:             make([]string, 0),
		fieldBoosts:        make(map[string]*float64),
		fuzzyPrefixLength:  -1,
		fuzzyMaxExpansions: -1,
	}
}