Skip to content

Commit f214f3d

Browse files
authored
CLOUDP-182930: fix oneOf tokenizer error via latest sdk (#2000)
1 parent 748e1c4 commit f214f3d

File tree

3 files changed

+62
-32
lines changed

3 files changed

+62
-32
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ require (
4040
github.com/tangzero/inflector v1.0.0
4141
github.com/withfig/autocomplete-tools/packages/cobra v1.2.0
4242
go.mongodb.org/atlas v0.27.0
43-
go.mongodb.org/atlas-sdk v0.10.0
43+
go.mongodb.org/atlas-sdk v0.11.0
4444
go.mongodb.org/mongo-driver v1.11.4
4545
go.mongodb.org/ops-manager v0.50.0
4646
golang.org/x/crypto v0.9.0

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -438,8 +438,8 @@ github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1
438438
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
439439
go.mongodb.org/atlas v0.27.0 h1:wGajyHOCDMucvk/REu0ZU3bIgRExVMB6qkUoFaBNoFs=
440440
go.mongodb.org/atlas v0.27.0/go.mod h1:L4BKwVx/OeEhOVjCSdgo90KJm4469iv7ZLzQms/EPTg=
441-
go.mongodb.org/atlas-sdk v0.10.0 h1:gsaHxHCkkWgRrIOvlpWvPHstYkekNi9Ecmy/HW5wkNk=
442-
go.mongodb.org/atlas-sdk v0.10.0/go.mod h1:GzQWxevVUwtUOk9I4DlYLZVvl17TEjTQsGNsH07JQpI=
441+
go.mongodb.org/atlas-sdk v0.11.0 h1:ZtBRZzYzrdQUHBJs87hHJ6rRw/VxbQI3/sRhefmQ+yg=
442+
go.mongodb.org/atlas-sdk v0.11.0/go.mod h1:GzQWxevVUwtUOk9I4DlYLZVvl17TEjTQsGNsH07JQpI=
443443
go.mongodb.org/mongo-driver v1.11.4 h1:4ayjakA013OdpGyL2K3ZqylTac/rMjrJOMZ1EHizXas=
444444
go.mongodb.org/mongo-driver v1.11.4/go.mod h1:PTSz5yu21bkT/wXpkS7WR5f0ddqw5quethTUn9WM+2g=
445445
go.mongodb.org/ops-manager v0.50.0 h1:H6OX1OJjNaUjO+mu+2XtPGPZHrwHBb4/Hn4ln+QF7uk=

test/e2e/atlas/search_test.go

Lines changed: 59 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -110,31 +110,6 @@ func TestSearch(t *testing.T) {
110110
}
111111
})
112112

113-
t.Run("list", func(t *testing.T) {
114-
cmd := exec.Command(cliPath,
115-
clustersEntity,
116-
searchEntity,
117-
indexEntity,
118-
"list",
119-
"--clusterName", g.clusterName,
120-
"--db=test",
121-
"--collection", collectionName,
122-
"--projectId", g.projectID,
123-
"-o=json")
124-
125-
cmd.Env = os.Environ()
126-
resp, err := cmd.CombinedOutput()
127-
128-
if err != nil {
129-
t.Fatalf("unexpected error: %v, resp: %v", err, string(resp))
130-
}
131-
132-
var indexes []atlasv2.FTSIndex
133-
if err := json.Unmarshal(resp, &indexes); assert.NoError(t, err) {
134-
assert.NotEmpty(t, indexes)
135-
}
136-
})
137-
138113
t.Run("Describe", func(t *testing.T) {
139114
cmd := exec.Command(cliPath,
140115
clustersEntity,
@@ -342,7 +317,7 @@ func TestSearch(t *testing.T) {
342317
},
343318
"author": {
344319
"type": "string",
345-
"analyzer": "lucene.english"
320+
"analyzer": "keywordLowerCase"
346321
}
347322
}
348323
},
@@ -352,16 +327,46 @@ func TestSearch(t *testing.T) {
352327
"multi": {
353328
"mySecondaryAnalyzer": {
354329
"type": "string",
355-
"analyzer": "lucene.french"
330+
"analyzer": "keywordLowerCase"
356331
}
357332
}
358333
},
359334
"tags": {
360335
"type": "string",
361-
"analyzer": "lucene.standard"
336+
"analyzer": "standardLowerCase"
362337
}
363338
}
364-
}
339+
},
340+
"analyzers":[
341+
{
342+
"charFilters":[
343+
344+
],
345+
"name":"keywordLowerCase",
346+
"tokenFilters":[
347+
{
348+
"type":"lowercase"
349+
}
350+
],
351+
"tokenizer":{
352+
"type":"keyword"
353+
}
354+
},
355+
{
356+
"charFilters":[
357+
358+
],
359+
"name":"standardLowerCase",
360+
"tokenFilters":[
361+
{
362+
"type":"lowercase"
363+
}
364+
],
365+
"tokenizer":{
366+
"type":"standard"
367+
}
368+
}
369+
]
365370
}`))
366371
err = tpl.Execute(file, map[string]string{
367372
"indexName": indexName,
@@ -457,4 +462,29 @@ func TestSearch(t *testing.T) {
457462
assert.Equal(t, index.Name, indexName)
458463
}
459464
})
465+
466+
t.Run("list", func(t *testing.T) {
467+
cmd := exec.Command(cliPath,
468+
clustersEntity,
469+
searchEntity,
470+
indexEntity,
471+
"list",
472+
"--clusterName", g.clusterName,
473+
"--db=test",
474+
"--collection", collectionName,
475+
"--projectId", g.projectID,
476+
"-o=json")
477+
478+
cmd.Env = os.Environ()
479+
resp, err := cmd.CombinedOutput()
480+
481+
if err != nil {
482+
t.Fatalf("unexpected error: %v, resp: %v", err, string(resp))
483+
}
484+
485+
var indexes []atlasv2.FTSIndex
486+
if err := json.Unmarshal(resp, &indexes); assert.NoError(t, err) {
487+
assert.NotEmpty(t, indexes)
488+
}
489+
})
460490
}

0 commit comments

Comments
 (0)