-
Notifications
You must be signed in to change notification settings - Fork 10
feat(text-index): Added support for text indexes #23
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
src/index.rs
Outdated
pub fn get_key_name(&self) -> String { | ||
match self { | ||
IndexKey::SortIndex(s) => match s.direction { | ||
SortOrder::Ascending => format!("{}_1", s.name), | ||
SortOrder::Descending => format!("{}_-1", s.name), | ||
}, | ||
|
||
IndexKey::TextIndex(t) => format!("{}_text", t.name), | ||
} | ||
} | ||
|
||
pub fn get_name(&self) -> String { | ||
match self { | ||
IndexKey::SortIndex(s) => s.name.to_string(), | ||
IndexKey::TextIndex(t) => t.name.to_string(), | ||
} | ||
} | ||
|
||
pub fn get_value(&self) -> Bson { | ||
match self { | ||
IndexKey::SortIndex(s) => s.direction.into(), | ||
IndexKey::TextIndex(_) => "text".into(), | ||
} | ||
} |
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.
Should these be private functions?
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.
Good point, I thought Rust would not like it if I tried to use them outside of the impl but it seems to work, will commit.
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.
Looks good to me! Thank you
No description provided.