Skip to content

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

Merged
merged 3 commits into from
Apr 13, 2023

Conversation

LucFauvel
Copy link
Contributor

No description provided.

@LucFauvel LucFauvel requested a review from CBenoit April 13, 2023 15:57
src/index.rs Outdated
Comment on lines 36 to 59
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(),
}
}
Copy link
Member

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?

Copy link
Contributor Author

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.

@CBenoit CBenoit enabled auto-merge (squash) April 13, 2023 18:27
Copy link
Member

@CBenoit CBenoit left a 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

@CBenoit CBenoit merged commit 541806e into master Apr 13, 2023
@CBenoit CBenoit deleted the add-text-index-support branch April 13, 2023 18:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants