-
Notifications
You must be signed in to change notification settings - Fork 25k
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
Refactor PhraseSuggestionBuilder.DirectCandidateGenerator #16185
Conversation
f9c3602
to
8428028
Compare
8428028
to
0735e24
Compare
@@ -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)) { |
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.
Can we make this either PhraseSuggestionBuilder.DirectCandidateGenerator
or DirectCandidateGenerator
?
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 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.
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.
++
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 just reference it as PhraseSuggestionBuilder.DirectCandidateGenerator
instead of its FQCN
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 prefer pulling this out, PhraseSuggestionBuilder is large enough already.
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.
0735e24
to
61c435e
Compare
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.
@colings86 thanks for the review. |
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