1
1
//
2
2
// DISCLAIMER
3
3
//
4
- // Copyright 2018-2023 ArangoDB GmbH, Cologne, Germany
4
+ // Copyright 2018-2024 ArangoDB GmbH, Cologne, Germany
5
5
//
6
6
// Licensed under the Apache License, Version 2.0 (the "License");
7
7
// you may not use this file except in compliance with the License.
@@ -28,6 +28,7 @@ import (
28
28
"github.com/stretchr/testify/require"
29
29
30
30
"github.com/arangodb/go-driver"
31
+ "github.com/arangodb/go-driver/util"
31
32
)
32
33
33
34
func newInt (v int ) * int {
@@ -139,7 +140,7 @@ func TestArangoSearchAnalyzerEnsureAnalyzer(t *testing.T) {
139
140
Properties : driver.ArangoSearchAnalyzerProperties {
140
141
Min : newInt64 (1 ),
141
142
Max : newInt64 (14 ),
142
- PreserveOriginal : newBool (false ),
143
+ PreserveOriginal : util . NewType (false ),
143
144
},
144
145
},
145
146
},
@@ -152,7 +153,7 @@ func TestArangoSearchAnalyzerEnsureAnalyzer(t *testing.T) {
152
153
Properties : driver.ArangoSearchAnalyzerProperties {
153
154
Min : newInt64 (1 ),
154
155
Max : newInt64 (14 ),
155
- PreserveOriginal : newBool (false ),
156
+ PreserveOriginal : util . NewType (false ),
156
157
},
157
158
},
158
159
ExpectedDefinition : & driver.ArangoSearchAnalyzerDefinition {
@@ -161,7 +162,7 @@ func TestArangoSearchAnalyzerEnsureAnalyzer(t *testing.T) {
161
162
Properties : driver.ArangoSearchAnalyzerProperties {
162
163
Min : newInt64 (1 ),
163
164
Max : newInt64 (14 ),
164
- PreserveOriginal : newBool (false ),
165
+ PreserveOriginal : util . NewType (false ),
165
166
166
167
// Check defaults for 3.6
167
168
StartMarker : newString ("" ),
@@ -179,7 +180,7 @@ func TestArangoSearchAnalyzerEnsureAnalyzer(t *testing.T) {
179
180
Properties : driver.ArangoSearchAnalyzerProperties {
180
181
Min : newInt64 (1 ),
181
182
Max : newInt64 (14 ),
182
- PreserveOriginal : newBool (false ),
183
+ PreserveOriginal : util . NewType (false ),
183
184
StartMarker : newString ("^" ),
184
185
EndMarker : newString ("^" ),
185
186
StreamType : newArangoSearchNGramStreamType (driver .ArangoSearchNGramStreamUTF8 ),
@@ -199,7 +200,7 @@ func TestArangoSearchAnalyzerEnsureAnalyzer(t *testing.T) {
199
200
Properties : driver.ArangoSearchAnalyzerProperties {
200
201
Min : newInt64 (1 ),
201
202
Max : newInt64 (14 ),
202
- PreserveOriginal : newBool (false ),
203
+ PreserveOriginal : util . NewType (false ),
203
204
StartMarker : newString ("^" ),
204
205
EndMarker : newString ("^" ),
205
206
StreamType : newArangoSearchNGramStreamType (driver .ArangoSearchNGramStreamUTF8 ),
@@ -217,11 +218,11 @@ func TestArangoSearchAnalyzerEnsureAnalyzer(t *testing.T) {
217
218
Type : driver .ArangoSearchAnalyzerTypeAQL ,
218
219
Properties : driver.ArangoSearchAnalyzerProperties {
219
220
QueryString : `FOR year IN [ 2011, 2012, 2013 ] FOR quarter IN [ 1, 2, 3, 4 ] RETURN { year, quarter, formatted: CONCAT(quarter, " / ", year)}` ,
220
- CollapsePositions : newBool (true ),
221
- KeepNull : newBool (false ),
222
- BatchSize : newInt (10 ),
221
+ CollapsePositions : util . NewType (true ),
222
+ KeepNull : util . NewType (false ),
223
+ BatchSize : util . NewType (10 ),
223
224
ReturnType : driver .ArangoSearchAnalyzerAQLReturnTypeString .New (),
224
- MemoryLimit : newInt (1024 * 1024 ),
225
+ MemoryLimit : util . NewType (1024 * 1024 ),
225
226
},
226
227
},
227
228
},
@@ -233,9 +234,9 @@ func TestArangoSearchAnalyzerEnsureAnalyzer(t *testing.T) {
233
234
Type : driver .ArangoSearchAnalyzerTypeGeoPoint ,
234
235
Properties : driver.ArangoSearchAnalyzerProperties {
235
236
Options : & driver.ArangoSearchAnalyzerGeoOptions {
236
- MaxCells : newInt (20 ),
237
- MinLevel : newInt (4 ),
238
- MaxLevel : newInt (23 ),
237
+ MaxCells : util . NewType (20 ),
238
+ MinLevel : util . NewType (4 ),
239
+ MaxLevel : util . NewType (23 ),
239
240
},
240
241
Latitude : []string {},
241
242
Longitude : []string {},
@@ -250,9 +251,9 @@ func TestArangoSearchAnalyzerEnsureAnalyzer(t *testing.T) {
250
251
Type : driver .ArangoSearchAnalyzerTypeGeoJSON ,
251
252
Properties : driver.ArangoSearchAnalyzerProperties {
252
253
Options : & driver.ArangoSearchAnalyzerGeoOptions {
253
- MaxCells : newInt (20 ),
254
- MinLevel : newInt (4 ),
255
- MaxLevel : newInt (23 ),
254
+ MaxCells : util . NewType (20 ),
255
+ MinLevel : util . NewType (4 ),
256
+ MaxLevel : util . NewType (23 ),
256
257
},
257
258
Type : driver .ArangoSearchAnalyzerGeoJSONTypeShape .New (),
258
259
},
@@ -267,9 +268,9 @@ func TestArangoSearchAnalyzerEnsureAnalyzer(t *testing.T) {
267
268
Properties : driver.ArangoSearchAnalyzerProperties {
268
269
Format : driver .FormatLatLngInt .New (),
269
270
Options : & driver.ArangoSearchAnalyzerGeoOptions {
270
- MaxCells : newInt (20 ),
271
- MinLevel : newInt (4 ),
272
- MaxLevel : newInt (23 ),
271
+ MaxCells : util . NewType (20 ),
272
+ MinLevel : util . NewType (4 ),
273
+ MaxLevel : util . NewType (23 ),
273
274
},
274
275
Type : driver .ArangoSearchAnalyzerGeoJSONTypeShape .New (),
275
276
},
@@ -280,9 +281,9 @@ func TestArangoSearchAnalyzerEnsureAnalyzer(t *testing.T) {
280
281
Properties : driver.ArangoSearchAnalyzerProperties {
281
282
Format : driver .FormatLatLngInt .New (),
282
283
Options : & driver.ArangoSearchAnalyzerGeoOptions {
283
- MaxCells : newInt (20 ),
284
- MinLevel : newInt (4 ),
285
- MaxLevel : newInt (23 ),
284
+ MaxCells : util . NewType (20 ),
285
+ MinLevel : util . NewType (4 ),
286
+ MaxLevel : util . NewType (23 ),
286
287
},
287
288
Type : driver .ArangoSearchAnalyzerGeoJSONTypeShape .New (),
288
289
},
@@ -326,7 +327,7 @@ func TestArangoSearchAnalyzerEnsureAnalyzer(t *testing.T) {
326
327
Name : "my-stopWords" ,
327
328
Type : driver .ArangoSearchAnalyzerTypeStopwords ,
328
329
Properties : driver.ArangoSearchAnalyzerProperties {
329
- Hex : newBool (true ),
330
+ Hex : util . NewType (true ),
330
331
Stopwords : []string {
331
332
"616e64" ,
332
333
"746865" ,
@@ -337,7 +338,7 @@ func TestArangoSearchAnalyzerEnsureAnalyzer(t *testing.T) {
337
338
Name : "my-stopWords" ,
338
339
Type : driver .ArangoSearchAnalyzerTypeStopwords ,
339
340
Properties : driver.ArangoSearchAnalyzerProperties {
340
- Hex : newBool (true ),
341
+ Hex : util . NewType (true ),
341
342
Stopwords : []string {
342
343
"616e64" ,
343
344
"746865" ,
@@ -356,7 +357,7 @@ func TestArangoSearchAnalyzerEnsureAnalyzer(t *testing.T) {
356
357
Analyzer : & driver.ArangoSearchAnalyzerDefinition {
357
358
Type : driver .ArangoSearchAnalyzerTypeStopwords ,
358
359
Properties : driver.ArangoSearchAnalyzerProperties {
359
- Hex : newBool (true ),
360
+ Hex : util . NewType (true ),
360
361
Stopwords : []string {
361
362
"616e64" ,
362
363
"746865" ,
@@ -373,7 +374,7 @@ func TestArangoSearchAnalyzerEnsureAnalyzer(t *testing.T) {
373
374
Analyzer : & driver.ArangoSearchAnalyzerDefinition {
374
375
Type : driver .ArangoSearchAnalyzerTypeStopwords ,
375
376
Properties : driver.ArangoSearchAnalyzerProperties {
376
- Hex : newBool (true ),
377
+ Hex : util . NewType (true ),
377
378
Stopwords : []string {
378
379
"616e64" ,
379
380
"746865" ,
@@ -450,7 +451,7 @@ func TestArangoSearchAnalyzerGet(t *testing.T) {
450
451
Properties : driver.ArangoSearchAnalyzerProperties {
451
452
Min : newInt64 (1 ),
452
453
Max : newInt64 (14 ),
453
- PreserveOriginal : newBool (false ),
454
+ PreserveOriginal : util . NewType (false ),
454
455
},
455
456
}
456
457
ensureAnalyzer (ctx , db , def , t )
@@ -484,7 +485,7 @@ func TestArangoSearchAnalyzerGetAll(t *testing.T) {
484
485
Properties : driver.ArangoSearchAnalyzerProperties {
485
486
Min : newInt64 (1 ),
486
487
Max : newInt64 (14 ),
487
- PreserveOriginal : newBool (false ),
488
+ PreserveOriginal : util . NewType (false ),
488
489
},
489
490
}
490
491
ensureAnalyzer (ctx , db , def , t )
@@ -524,7 +525,7 @@ func TestArangoSearchAnalyzerRemove(t *testing.T) {
524
525
Properties : driver.ArangoSearchAnalyzerProperties {
525
526
Min : newInt64 (1 ),
526
527
Max : newInt64 (14 ),
527
- PreserveOriginal : newBool (false ),
528
+ PreserveOriginal : util . NewType (false ),
528
529
},
529
530
}
530
531
a := ensureAnalyzer (ctx , db , def , t )
0 commit comments