-
Notifications
You must be signed in to change notification settings - Fork 626
/
Copy pathboostingquery.go
executable file
·80 lines (66 loc) · 2.58 KB
/
boostingquery.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
// Licensed to Elasticsearch B.V. under one or more contributor
// license agreements. See the NOTICE file distributed with
// this work for additional information regarding copyright
// ownership. Elasticsearch B.V. licenses this file to you under
// the Apache License, Version 2.0 (the "License"); you may
// not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
// Code generated from the elasticsearch-specification DO NOT EDIT.
// https://github.com/elastic/elasticsearch-specification/tree/e0ea3dc890d394d682096cc862b3bd879d9422e9
package types
// BoostingQuery type.
//
// https://github.com/elastic/elasticsearch-specification/blob/e0ea3dc890d394d682096cc862b3bd879d9422e9/specification/_types/query_dsl/compound.ts#L36-L40
type BoostingQuery struct {
Boost *float32 `json:"boost,omitempty"`
Negative *QueryContainer `json:"negative,omitempty"`
NegativeBoost float64 `json:"negative_boost"`
Positive *QueryContainer `json:"positive,omitempty"`
QueryName_ *string `json:"_name,omitempty"`
}
// BoostingQueryBuilder holds BoostingQuery struct and provides a builder API.
type BoostingQueryBuilder struct {
v *BoostingQuery
}
// NewBoostingQuery provides a builder for the BoostingQuery struct.
func NewBoostingQueryBuilder() *BoostingQueryBuilder {
r := BoostingQueryBuilder{
&BoostingQuery{},
}
return &r
}
// Build finalize the chain and returns the BoostingQuery struct
func (rb *BoostingQueryBuilder) Build() BoostingQuery {
return *rb.v
}
func (rb *BoostingQueryBuilder) Boost(boost float32) *BoostingQueryBuilder {
rb.v.Boost = &boost
return rb
}
func (rb *BoostingQueryBuilder) Negative(negative *QueryContainerBuilder) *BoostingQueryBuilder {
v := negative.Build()
rb.v.Negative = &v
return rb
}
func (rb *BoostingQueryBuilder) NegativeBoost(negativeboost float64) *BoostingQueryBuilder {
rb.v.NegativeBoost = negativeboost
return rb
}
func (rb *BoostingQueryBuilder) Positive(positive *QueryContainerBuilder) *BoostingQueryBuilder {
v := positive.Build()
rb.v.Positive = &v
return rb
}
func (rb *BoostingQueryBuilder) QueryName_(queryname_ string) *BoostingQueryBuilder {
rb.v.QueryName_ = &queryname_
return rb
}