-
Notifications
You must be signed in to change notification settings - Fork 248
Add search by labels. #284
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
Differentiate find with boolean AND with OR.
|
@dastultz Could you try to add some integration tests please ? |
|
Sorry for the delay, I plan to do this, please don't close the issue. Thanks. |
Unit tests.
|
Added unit tests. I did not run them! Documented article contents needed in sandbox. |
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 but i’ll leave it to @aheritier
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.
it's a good PR @dastultz
I created the documents based on your scenario but found an issue (we should/could probably automate it)
Fix typo in assertion.
| .set("query", searchTerm).set("section", sectionId), handleList(Article.class, "results")); | ||
| } | ||
|
|
||
| public Iterable<Article> getArticleFromSomeLabels(List<String> labels) { |
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.
Naming seems a little off to me, especially with the fact singular is used for returning a collection. How about something like..
getArticlesWithAllLabels
searchArticlesWithLabels
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 don't understand what is meant by "get" vs "search" if anything. The part I was looking to make clear was that one method requires at least one label to be found, the other requires all labels to be found. IMO, "WithAll" is good, but the idea of "with at least one" is not captured in the name "searchArticlesWithLabels". Not sure if "search" implies such behavior. You objected to the use of singular for returning a collection, I agree with that, I followed the existing pattern established by the getArticleFromSearch method. I think getArticlesFromSomeLabels and getArticlesFromAllLabels best captures the concerns, though I don't like the apparent API inconsistency with the singular Article vs Articles.
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.
How about getArticlesFromAllLabels and getArticlesFromAnyLabels
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.
Works for me, as long as everyone doesn't mind the inconsistency of Article plurality with getArticleFromSearch. Should I make the change, or will someone else do it?
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.
Or introduce corrected method with deprecated annotation on the singular.
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.
Who is the "gatekeeper" of the public-facing API? I'm trying to add functionality but not dictate API design in general. I feel like someone more qualified should handle the naming issue. I'm happy with getArticlesFromAllLabels and getArticlesFromAnyLabels. I'm going to make that change and hope it goes through.
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.
See inline comments.
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 confirm that the tests are passing now
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.
Please see inline comments wrt naming.
Rename API methods as per code review.
No description provided.