Skip to content
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

Refactor PhraseSuggestionBuilder.DirectCandidateGenerator #16185

Merged
merged 1 commit into from
Feb 1, 2016

Conversation

cbuescher
Copy link
Member

As a prerequisite for refactoring the whole PhraseSuggestionBuilder to be able to be parsed and streamed from the coordinating node, the DirectCandidateGenerator must implement Writeable, be able to parse a new instance (fromXContent()) and later when transported to the shard to generate a PhraseSuggestionContext.DirectCandidateGenerator. Also adding equals/hashCode and tests and moving DirectCandidateGenerator to its own DirectCandidateGeneratorBuilder class.

Relates to #10217

@cbuescher cbuescher force-pushed the ref-DirectCandidateGenerator branch from f9c3602 to 8428028 Compare January 22, 2016 15:20
@cbuescher cbuescher force-pushed the ref-DirectCandidateGenerator branch from 8428028 to 0735e24 Compare January 28, 2016 13:51
@@ -98,18 +98,10 @@ public PhraseSuggestParser(PhraseSuggester suggester) {
}
}
} else if (token == Token.START_ARRAY) {
if ("direct_generator".equals(fieldName) || "directGenerator".equals(fieldName)) {
if (parseFieldMatcher.match(fieldName, org.elasticsearch.search.suggest.phrase.PhraseSuggestionBuilder.DirectCandidateGenerator.DIRECT_GENERATOR_FIELD)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we make this either PhraseSuggestionBuilder.DirectCandidateGenerator or DirectCandidateGenerator?

Copy link
Member Author

Choose a reason for hiding this comment

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

I would have really liked to pull this to its own class, but there is already org.elasticsearch.search.suggest.phrase.DirectCandidateGenerator which is the same thing but with shard-dependent properties (Analyzers etc...), so I will rename this thing to DirectCandidateGeneratorBuilder.

Copy link
Contributor

Choose a reason for hiding this comment

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

++

Copy link
Contributor

Choose a reason for hiding this comment

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

Or just reference it as PhraseSuggestionBuilder.DirectCandidateGenerator instead of its FQCN

Copy link
Member Author

Choose a reason for hiding this comment

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

I prefer pulling this out, PhraseSuggestionBuilder is large enough already.

@colings86
Copy link
Contributor

left a couple of minor comments but it LGTM

As a prerequisite for refactoring the whole PhraseSuggestionBuilder
to be able to be parsed and streamed from the coordinating node, the
DirectCandidateGenerator must implement Writeable, be able to parse
a new instance (fromXContent()) and later when transported to the
shard to generate a PhraseSuggestionContext.DirectCandidateGenerator.
Also adding equals/hashCode and tests and moving DirectCandidateGenerator
to its own DirectCandidateGeneratorBuilder class.
@cbuescher cbuescher force-pushed the ref-DirectCandidateGenerator branch from 0735e24 to 61c435e Compare February 1, 2016 12:14
cbuescher added a commit that referenced this pull request Feb 1, 2016
As a prerequisite for refactoring the whole PhraseSuggestionBuilder
to be able to be parsed and streamed from the coordinating node, the
DirectCandidateGenerator must implement Writeable, be able to parse
a new instance (fromXContent()) and later when transported to the
shard to generate a PhraseSuggestionContext.DirectCandidateGenerator.
Also adding equals/hashCode and tests and moving DirectCandidateGenerator
to its own DirectCandidateGeneratorBuilder class.
@cbuescher cbuescher merged commit 220bf7b into elastic:master Feb 1, 2016
@cbuescher
Copy link
Member Author

@colings86 thanks for the review.

@cbuescher cbuescher deleted the ref-DirectCandidateGenerator branch March 31, 2016 09:26
@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
>non-issue :Search Relevance/Suggesters "Did you mean" and suggestions as you type :Search/Search Search-related issues that do not fall into other categories v5.0.0-alpha1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants