-
Notifications
You must be signed in to change notification settings - Fork 909
GODRIVER-3125 Allow to set search index type #1649
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
API Change Report./mongo/optionscompatible changes(*SearchIndexesOptions).SetType: added |
Co-authored-by: Preston Vasquez <prestonvasquez@icloud.com>
Co-authored-by: Preston Vasquez <prestonvasquez@icloud.com>
Co-authored-by: Preston Vasquez <prestonvasquez@icloud.com>
Co-authored-by: Preston Vasquez <prestonvasquez@icloud.com>
Co-authored-by: Preston Vasquez <prestonvasquez@icloud.com>
@@ -26,7 +26,7 @@ tests: | |||
- name: createSearchIndex | |||
object: *collection0 | |||
arguments: | |||
model: { definition: &definition { mappings: { dynamic: true } } } | |||
model: { definition: &definition { mappings: { dynamic: true } } , type: 'search' } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These tests are failing because we do not include Type in executeCreateSearchIndexes
and executeCreateSearchIndex
operations. This can be fixed by updating the case here and here to include Type
. e.g.
var m struct {
Definition interface{}
Name *string
Type *string
}
err = bson.Unmarshal(val.Value, &m)
if err != nil {
return nil, err
}
model := mongo.SearchIndexModel{
Definition: m.Definition,
Options: options.SearchIndexes(),
}
model.Options.Name = m.Name
model.Options.Type = m.Type
models = append(models, model)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
|
||
mt.RunOpts("case 7: Driver can successfully handle search index types when creating indexes", | ||
mtest.NewOptions().CollectionName(case7CollName.String()), | ||
func(mt *mtest.T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just realized this change requires everything after this line to be indented, my suggestion didn't include that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
|
||
mt.RunOpts("case 8: Driver requires explicit type to create a vector search index", | ||
mtest.NewOptions().CollectionName(case8CollName.String()), | ||
func(mt *mtest.T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just realized this change requires everything after this line to be indented, my suggestion didn't include that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
Co-authored-by: Jeroen Vervaeke <jeroen.vervaeke@mongodb.com> Co-authored-by: Preston Vasquez <prestonvasquez@icloud.com> (cherry picked from commit 0f10f5e)
GODRIVER-3125
Summary
Add the ability to pick the search index type when creating a new search index.
Background & Motivation
Drivers must support use of the type field when creating search indexes. Creating a vector search index requires specifying type=vectorSearch.