-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmodel_knn_query.go
298 lines (248 loc) · 6.66 KB
/
model_knn_query.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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
/*
Manticore Search Client
Сlient for Manticore Search.
API version: 5.0.0
Contact: [email protected]
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package openapi
import (
"encoding/json"
_"bytes"
_"fmt"
)
// checks if the KnnQuery type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &KnnQuery{}
// KnnQuery Object representing a k-nearest neighbor search query
type KnnQuery struct {
// Field to perform the k-nearest neighbor search on
Field string
// The number of nearest neighbors to return
K int32
// The vector used as input for the KNN search
QueryVector []float32
// The docuemnt ID used as input for the KNN search
DocId *int64
// Optional parameter controlling the accuracy of the search
Ef *int32
Filter *QueryFilter
}
type _KnnQuery KnnQuery
// NewKnnQuery instantiates a new KnnQuery object
// This constructor will assign default values to properties that have it defined,
// and makes sure properties required by API are set, but the set of arguments
// will change when the set of required properties is changed
func NewKnnQuery(field string, k int32) *KnnQuery {
this := KnnQuery{}
this.Field = field
this.K = k
return &this
}
// NewKnnQueryWithDefaults instantiates a new KnnQuery object
// This constructor will only assign default values to properties that have it defined,
// but it doesn't guarantee that properties required by API are set
func NewKnnQueryWithDefaults() *KnnQuery {
this := KnnQuery{}
return &this
}
// GetField returns the Field field value
func (o *KnnQuery) GetField() string {
if o == nil {
var ret string
return ret
}
return o.Field
}
// GetFieldOk returns a tuple with the Field field value
// and a boolean to check if the value has been set.
func (o *KnnQuery) GetFieldOk() (*string, bool) {
if o == nil {
return nil, false
}
return &o.Field, true
}
// SetField sets field value
func (o *KnnQuery) SetField(v string) {
o.Field = v
}
// GetK returns the K field value
func (o *KnnQuery) GetK() int32 {
if o == nil {
var ret int32
return ret
}
return o.K
}
// GetKOk returns a tuple with the K field value
// and a boolean to check if the value has been set.
func (o *KnnQuery) GetKOk() (*int32, bool) {
if o == nil {
return nil, false
}
return &o.K, true
}
// SetK sets field value
func (o *KnnQuery) SetK(v int32) {
o.K = v
}
// GetQueryVector returns the QueryVector field value if set, zero value otherwise.
func (o *KnnQuery) GetQueryVector() []float32 {
if o == nil || IsNil(o.QueryVector) {
var ret []float32
return ret
}
return o.QueryVector
}
// GetQueryVectorOk returns a tuple with the QueryVector field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *KnnQuery) GetQueryVectorOk() ([]float32, bool) {
if o == nil || IsNil(o.QueryVector) {
return nil, false
}
return o.QueryVector, true
}
// HasQueryVector returns a boolean if a field has been set.
func (o *KnnQuery) HasQueryVector() bool {
if o != nil && !IsNil(o.QueryVector) {
return true
}
return false
}
// SetQueryVector gets a reference to the given []float32 and assigns it to the QueryVector field.
func (o *KnnQuery) SetQueryVector(v []float32) {
o.QueryVector = v
}
// GetDocId returns the DocId field value if set, zero value otherwise.
func (o *KnnQuery) GetDocId() int64 {
if o == nil || IsNil(o.DocId) {
var ret int64
return ret
}
return *o.DocId
}
// GetDocIdOk returns a tuple with the DocId field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *KnnQuery) GetDocIdOk() (*int64, bool) {
if o == nil || IsNil(o.DocId) {
return nil, false
}
return o.DocId, true
}
// HasDocId returns a boolean if a field has been set.
func (o *KnnQuery) HasDocId() bool {
if o != nil && !IsNil(o.DocId) {
return true
}
return false
}
// SetDocId gets a reference to the given int64 and assigns it to the DocId field.
func (o *KnnQuery) SetDocId(v int64) {
o.DocId = &v
}
// GetEf returns the Ef field value if set, zero value otherwise.
func (o *KnnQuery) GetEf() int32 {
if o == nil || IsNil(o.Ef) {
var ret int32
return ret
}
return *o.Ef
}
// GetEfOk returns a tuple with the Ef field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *KnnQuery) GetEfOk() (*int32, bool) {
if o == nil || IsNil(o.Ef) {
return nil, false
}
return o.Ef, true
}
// HasEf returns a boolean if a field has been set.
func (o *KnnQuery) HasEf() bool {
if o != nil && !IsNil(o.Ef) {
return true
}
return false
}
// SetEf gets a reference to the given int32 and assigns it to the Ef field.
func (o *KnnQuery) SetEf(v int32) {
o.Ef = &v
}
// GetFilter returns the Filter field value if set, zero value otherwise.
func (o *KnnQuery) GetFilter() QueryFilter {
if o == nil || IsNil(o.Filter) {
var ret QueryFilter
return ret
}
return *o.Filter
}
// GetFilterOk returns a tuple with the Filter field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *KnnQuery) GetFilterOk() (*QueryFilter, bool) {
if o == nil || IsNil(o.Filter) {
return nil, false
}
return o.Filter, true
}
// HasFilter returns a boolean if a field has been set.
func (o *KnnQuery) HasFilter() bool {
if o != nil && !IsNil(o.Filter) {
return true
}
return false
}
// SetFilter gets a reference to the given QueryFilter and assigns it to the Filter field.
func (o *KnnQuery) SetFilter(v QueryFilter) {
o.Filter = &v
}
func (o KnnQuery) MarshalJSON() ([]byte, error) {
toSerialize,err := o.ToMap()
if err != nil {
return []byte{}, err
}
return json.Marshal(toSerialize)
}
func (o KnnQuery) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
toSerialize["field"] = o.Field
toSerialize["k"] = o.K
if !IsNil(o.QueryVector) {
toSerialize["query_vector"] = o.QueryVector
}
if !IsNil(o.DocId) {
toSerialize["doc_id"] = o.DocId
}
if !IsNil(o.Ef) {
toSerialize["ef"] = o.Ef
}
if !IsNil(o.Filter) {
toSerialize["filter"] = o.Filter
}
return toSerialize, nil
}
type NullableKnnQuery struct {
value *KnnQuery
isSet bool
}
func (v NullableKnnQuery) Get() *KnnQuery {
return v.value
}
func (v *NullableKnnQuery) Set(val *KnnQuery) {
v.value = val
v.isSet = true
}
func (v NullableKnnQuery) IsSet() bool {
return v.isSet
}
func (v *NullableKnnQuery) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableKnnQuery(val *KnnQuery) *NullableKnnQuery {
return &NullableKnnQuery{value: val, isSet: true}
}
func (v NullableKnnQuery) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableKnnQuery) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}