Skip to content

Commit c25a757

Browse files
authored
GT-138 Add missing deduplicate param to PersistentIndex (#411)
1 parent dc46b55 commit c25a757

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
- Fix `lastValue` field type
55
- Setup Go-lang linter with minimal configuration
66
- Use Go 1.17.6
7+
- Add missing `deduplicate` param to PersistentIndex
78

89
## [1.3.2](https://github.com/arangodb/go-driver/tree/v1.3.2) (2022-05-16)
910
- Fix selectivityEstimate Index field type

collection_indexes.go

+7
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ type EnsureGeoIndexOptions struct {
103103
}
104104

105105
// EnsureHashIndexOptions contains specific options for creating a hash index.
106+
// Note: "hash" and "skiplist" are only aliases for "persistent" with the RocksDB storage engine which is only storage engine since 3.7
106107
type EnsureHashIndexOptions struct {
107108
// If true, then create a unique index.
108109
Unique bool
@@ -121,11 +122,16 @@ type EnsureHashIndexOptions struct {
121122
}
122123

123124
// EnsurePersistentIndexOptions contains specific options for creating a persistent index.
125+
// Note: "hash" and "skiplist" are only aliases for "persistent" with the RocksDB storage engine which is only storage engine since 3.7
124126
type EnsurePersistentIndexOptions struct {
125127
// If true, then create a unique index.
126128
Unique bool
127129
// If true, then create a sparse index.
128130
Sparse bool
131+
// If true, de-duplication of array-values, before being added to the index, will be turned off.
132+
// This flag requires ArangoDB 3.2.
133+
// Note: this setting is only relevant for indexes with array fields (e.g. "fieldName[*]")
134+
NoDeduplicate bool
129135
// InBackground if true will not hold an exclusive collection lock for the entire index creation period (rocksdb only).
130136
InBackground bool
131137
// Name optional user defined name used for hints in AQL queries
@@ -135,6 +141,7 @@ type EnsurePersistentIndexOptions struct {
135141
}
136142

137143
// EnsureSkipListIndexOptions contains specific options for creating a skip-list index.
144+
// Note: "hash" and "skiplist" are only aliases for "persistent" with the RocksDB storage engine which is only storage engine since 3.7
138145
type EnsureSkipListIndexOptions struct {
139146
// If true, then create a unique index.
140147
Unique bool

collection_indexes_impl.go

+4
Original file line numberDiff line numberDiff line change
@@ -213,12 +213,16 @@ func (c *collection) EnsurePersistentIndex(ctx context.Context, fields []string,
213213
Type: string(PersistentIndex),
214214
Fields: fields,
215215
}
216+
off := false
216217
if options != nil {
217218
input.InBackground = &options.InBackground
218219
input.Name = options.Name
219220
input.Unique = &options.Unique
220221
input.Sparse = &options.Sparse
221222
input.Estimates = options.Estimates
223+
if options.NoDeduplicate {
224+
input.Deduplicate = &off
225+
}
222226
}
223227
idx, created, err := c.ensureIndex(ctx, input)
224228
if err != nil {

0 commit comments

Comments
 (0)