Skip to content

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

Merged
merged 12 commits into from
May 18, 2020
Merged

Conversation

gkorland
Copy link
Contributor

No description provided.

@gkorland gkorland requested a review from gavrie December 22, 2019 11:52
@gkorland gkorland changed the title add index del_document add index del_document and extended create_field Dec 25, 2019
@gkorland gkorland requested a review from gavrie May 10, 2020 11:49
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 {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. I wouldn't make the tag_options argument optional, but rather always pass an actual TagOptions.
    Make use of the Default 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).
  2. While you're at it, I would put the name and weight inside the struct as well so the call site is self-explanatory.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Agree
  2. It's not a pattern we use across the API, the TagOptions are really options while name can't have default value

Copy link
Contributor

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?

Copy link
Contributor Author

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

@gkorland gkorland requested a review from gavrie May 13, 2020 18:27
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 {
Copy link
Contributor

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?

@gkorland gkorland merged commit e0e2b98 into master May 18, 2020
@gkorland gkorland deleted the del_doc branch May 18, 2020 10:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants