GODRIVER-3125 Allow to set search index type#1649
Merged
blink1073 merged 11 commits intomongodb:v1from Jun 3, 2024
Merged
Conversation
Contributor
API Change Report./mongo/optionscompatible changes(*SearchIndexesOptions).SetType: added |
prestonvasquez
requested changes
May 31, 2024
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>
prestonvasquez
requested changes
May 31, 2024
| object: *collection0 | ||
| arguments: | ||
| model: { definition: &definition { mappings: { dynamic: true } } } | ||
| model: { definition: &definition { mappings: { dynamic: true } } , type: 'search' } |
Member
There was a problem hiding this comment.
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)|
|
||
| mt.RunOpts("case 7: Driver can successfully handle search index types when creating indexes", | ||
| mtest.NewOptions().CollectionName(case7CollName.String()), | ||
| func(mt *mtest.T) { |
Member
There was a problem hiding this comment.
I just realized this change requires everything after this line to be indented, my suggestion didn't include that
|
|
||
| mt.RunOpts("case 8: Driver requires explicit type to create a vector search index", | ||
| mtest.NewOptions().CollectionName(case8CollName.String()), | ||
| func(mt *mtest.T) { |
Member
There was a problem hiding this comment.
I just realized this change requires everything after this line to be indented, my suggestion didn't include that
prestonvasquez
approved these changes
Jun 3, 2024
blink1073
added a commit
to blink1073/mongo-go-driver
that referenced
this pull request
Jun 3, 2024
Co-authored-by: Jeroen Vervaeke <jeroen.vervaeke@mongodb.com> Co-authored-by: Preston Vasquez <prestonvasquez@icloud.com> (cherry picked from commit 0f10f5e)
This was referenced Mar 4, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.