-
Notifications
You must be signed in to change notification settings - Fork 3
add index del_document and extended create_field #9
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
@@ -38,7 +44,7 @@ impl Index { | |||
Self { inner: index } | |||
} | |||
|
|||
pub fn create_field(&self, name: &str) -> Field { | |||
pub fn create_field(&self, name: &str, weight: f64, tag_options: Option<&TagOptions>) -> Field { |
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 wouldn't make the
tag_options
argument optional, but rather always pass an actualTagOptions
.
Make use of theDefault
trait to create this argument if it doesn't need to be customized (see https://doc.rust-lang.org/1.43.0/std/default/trait.Default.html). - While you're at it, I would put the name and weight inside the struct as well so the call site is self-explanatory.
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.
- Agree
- It's not a pattern we use across the API, the TagOptions are really options while name can't have default value
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.
Agreed regarding name
, but weight
is optional; why force the user to specify it when the RS API doesn't require 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.
Weight is not optional by the RediSearch API
src/index.rs
Outdated
@@ -38,7 +44,7 @@ impl Index { | |||
Self { inner: index } | |||
} | |||
|
|||
pub fn create_field(&self, name: &str) -> Field { | |||
pub fn create_field(&self, name: &str, weight: f64, tag_options: Option<&TagOptions>) -> Field { |
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.
Agreed regarding name
, but weight
is optional; why force the user to specify it when the RS API doesn't require that?
No description provided.