// Boost sets the boost to apply to this query.
346441
func (q *MatchPhraseQuery) Boost(boost float64) *MatchPhraseQuery {
	q.boost = &boost
	return q
}
1146764
func (b *SearchRequestBuilder) Query() *QueryBuilder {
	if b.queryBuilder == nil {
		b.queryBuilder = NewQueryBuilder()
	}
	return b.queryBuilder
}
1268872
func (q *ConjunctionQuery) Boost(boost float32) *ConjunctionQuery {
	q.options["boost"] = boost
	return q
}
378479
func (rdb RethinkDBKeyStore) Bootstrap() error {
	if err := rethinkdb.SetupDB(rdb.sess, rdb.dbName, []rethinkdb.Table{
		PrivateKeysRethinkTable,
	}); err != nil {
		return err
	}
	return rethinkdb.CreateAndGrantDBUser(rdb.sess, rdb.dbName, rdb.user, rdb.password)
}
145649
func (q *BooleanQuery) Boost(boost float32) *BooleanQuery {
	q.data.Boost = boost
	return q
}
100823
func (s *CountService) Query(query Query) *CountService {
	s.query = query
	return s
}
871030
func (q *DisMaxQuery) Source() (interface{}, error) {
	// {
	//  "dis_max" : {
	//    "tie_breaker" : 0.7,
	//    "boost" : 1.2,
	//    "queries" : {
	//      {
	//        "term" : { "age" : 34 }
	//      },
	//      {
	//        "term" : { "age" : 35 }
	//      }
	//    ]
	//  }
	// }

	query := make(map[string]interface{})
	params := make(map[string]interface{})
	query["dis_max"] = params

	if q.tieBreaker != nil {
		params["tie_breaker"] = *q.tieBreaker
	}
	if q.boost != nil {
		params["boost"] = *q.boost
	}
	if q.queryName != "" {
		params["_name"] = q.queryName
	}

	// queries
	var clauses []interface{}
	for _, subQuery := range q.queries {
		src, err := subQuery.Source()
		if err != nil {
			return nil, err
		}
		clauses = append(clauses, src)
	}
	params["queries"] = clauses

	return query, nil
}
651191
func (q *RegexpQuery) Boost(boost float32) *RegexpQuery {
	q.options["boost"] = boost
	return q
}
1108810
func (q *NumericRangeQuery) Boost(boost float32) *NumericRangeQuery {
	q.options["boost"] = boost
	return q
}
738229
func NewIdsQuery(types ...string) IdsQuery {
	q := IdsQuery{
		types:  types,
		values: make([]string, 0),
		boost:  -1.0,
	}
	return q
}
516108
func (c *Context) Query(name string) (v string) {
	return c.query.Get(name)
}
1033945
func BootStrap() {
	if modelCache.done {
		return
	}

	modelCache.Lock()
	defer modelCache.Unlock()
	bootStrap()
	modelCache.done = true
}
932723
func (q *PrefixQuery) Boost(boost float64) *PrefixQuery {
	q.boost = &boost
	return q
}
1230491
func (q *DateRangeQuery) Boost(boost float32) *DateRangeQuery {
	q.options["boost"] = boost
	return q
}
774606
func (q NestedQuery) Source() interface{} {
	// {
	//   "nested" : {
	//     "query" : {
	//       "bool" : {
	//         "must" : [
	//           {
	//             "match" : {"obj1.name" : "blue"}
	//           },
	//           {
	//             "range" : {"obj1.count" : {"gt" : 5}}
	//           }
	//         ]
	//       }
	//     },
	//     "filter" : {
	//       ...
	//     },
	//     "path" : "obj1",
	//     "score_mode" : "avg",
	//     "boost" : 1.0
	//   }
	// }

	query := make(map[string]interface{})

	nq := make(map[string]interface{})
	query["nested"] = nq
	if q.query != nil {
		nq["query"] = q.query.Source()
	}
	if q.filter != nil {
		nq["filter"] = q.filter.Source()
	}
	nq["path"] = q.path
	if q.scoreMode != "" {
		nq["score_mode"] = q.scoreMode
	}
	if q.boost != nil {
		nq["boost"] = *q.boost
	}
	if q.queryName != "" {
		nq["_name"] = q.queryName
	}
	if q.innerHit != nil {
		nq["inner_hits"] = q.innerHit.Source()
	}
	return query
}
1286001
func (q FuzzyQuery) Source() interface{} {
	// {
	//	"fuzzy" : {
	//		"user" : {
	//      "value" : "ki",
	//      "boost" : 1.0,
	//      "fuzziness" : 2,
	//      "prefix_length" : 0,
	//      "max_expansions" : 100
	//    }
	// }

	source := make(map[string]interface{})

	query := make(map[string]interface{})
	source["fuzzy"] = query

	fq := make(map[string]interface{})
	query[q.name] = fq

	fq["value"] = q.value

	if q.boost != -1.0 {
		fq["boost"] = q.boost
	}
	if q.transpositions != nil {
		fq["transpositions"] = *q.transpositions
	}
	if q.fuzziness != nil {
		fq["fuzziness"] = q.fuzziness
	}
	if q.prefixLength != nil {
		fq["prefix_length"] = *q.prefixLength
	}
	if q.maxExpansions != nil {
		fq["max_expansions"] = *q.maxExpansions
	}
	if q.queryName != "" {
		fq["_name"] = q.queryName
	}

	return source
}
1272557
func (q *MatchAllQuery) Boost(boost float64) *MatchAllQuery {
	q.boost = &boost
	return q
}