Skip to content

Initial refactoring for completion suggester#16398

Merged
areek merged 1 commit intoelastic:feature-suggest-refactoringfrom
areek:feature-suggest-refactoring
Feb 10, 2016
Merged

Initial refactoring for completion suggester#16398
areek merged 1 commit intoelastic:feature-suggest-refactoringfrom
areek:feature-suggest-refactoring

Conversation

@areek
Copy link
Copy Markdown
Contributor

@areek areek commented Feb 3, 2016

This PR implements serialization methods for CompletionSuggestionBuilder based on the suggest refactoring work started in #16241 and improves test coverage. This simplifies CompletionSuggestionBuilder by making fuzzy, regex and context queries implement their own serialization methods.

@areek areek added review :Search Relevance/Suggesters "Did you mean" and suggestions as you type labels Feb 3, 2016
@areek areek force-pushed the feature-suggest-refactoring branch from e87cc5b to 1eef734 Compare February 3, 2016 05:15
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nit: Everything okay, but I found this (and the following same constructs) a little hard to read. Can I suggest writing the boolean flag first without conditions (e.g. out.writeBoolean(fuzzyOptions != null) and then have the if-block only? But either was is fine.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Now we write the boolean flag first followed by an if-only block

@cbuescher
Copy link
Copy Markdown
Member

@areek looks great, I left a few small comments but other than that tests look good and also pulling out all those separate classes makes things much easier to understand I think.

@areek areek force-pushed the feature-suggest-refactoring branch 2 times, most recently from 6c5845f to 21c1da6 Compare February 10, 2016 05:11
@areek
Copy link
Copy Markdown
Contributor Author

areek commented Feb 10, 2016

@cbuescher Thanks for the review. I addressed all your comments.
CompletionSuggestionBuilder#innerFromXContent has not been implemented yet. We should clean up the parser in CompletionSuggestParser to use CompletionSuggestionBuilder as the consumer and fix setters with multiple params [(prefix, fuzzy), (prefix, regex), etc.] before.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nit: can both new helper methods go somewhere further down in ESTestCase? From the comments it seems someone tries to keep some order here, and this would be the setup / cleanup section. Also maybe both should be public? Although protected also works, we need it in tests that subclass this anyway.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the suggestion, moved the helper methods to the right section

@cbuescher
Copy link
Copy Markdown
Member

@areek thanks, left one minor comment and I'm getting a few test failures (StringDistanceImplTests, TermSuggestionBuilderTests, CompletionSuggesterBuilderTests), some of which might already be fixed on the feature branch.
Otherwise LGTM. Implementing parsing via innerFromXContent can be another PR, or did you want to add that here?

@areek
Copy link
Copy Markdown
Contributor Author

areek commented Feb 10, 2016

Thanks @cbuescher for looking, I think we should merge this in after investigating the test failures and implement parsing via innerFromXContent for CompletionSuggestionBuilder in a subsequent PR.

@areek areek force-pushed the feature-suggest-refactoring branch from 0e8a3a1 to 2038429 Compare February 10, 2016 21:22
@areek areek merged commit 2038429 into elastic:feature-suggest-refactoring Feb 10, 2016
@clintongormley clintongormley added :Search/Search Search-related issues that do not fall into other categories and removed :Search Refactoring labels Feb 14, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

:Search Relevance/Suggesters "Did you mean" and suggestions as you type :Search/Search Search-related issues that do not fall into other categories

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants