-
Notifications
You must be signed in to change notification settings - Fork 197
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
feat: Create and alias index #813
base: main
Are you sure you want to change the base?
Conversation
Hi @SoulPancake, I just reviewed it again and left some comments. Could you also write some tests to demonstrate how a user can use this feature? |
|
||
newIndex := alias + "_v1" | ||
if aliasExists && currentIndex != "" { | ||
// Find the last occurrence of "_v" followed by digits |
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.
What do you think about this? @rueian
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.
LGTM. Please update for the JSONRepository as well.
om/hash.go
Outdated
var currentIndex string | ||
infoCmd := r.client.B().FtInfo().Index(alias).Build() | ||
infoResp, err := r.client.Do(ctx, infoCmd).ToMap() | ||
aliasExists := err == nil |
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.
What will be the error returned when the index does not exist? Will it be a redis Nil? I think we should return early here if the err is caused by other reasons, such as network failures.
Co-authored-by: Rueian <rueiancsie@gmail.com>
infoCmd := r.client.B().FtInfo().Index(alias).Build() | ||
infoResp, err := r.client.Do(ctx, infoCmd).ToMap() | ||
if err != nil { | ||
if strings.Contains(err.Error(), "Unknown index name") { |
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 think this should work @rueian
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.
ok. please write tests for 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.
sure, will do the changes in JSON as well and then write UTs
No description provided.