Enable serialization and parsing from xContent for SmoothingModels#16130
Enable serialization and parsing from xContent for SmoothingModels#16130cbuescher merged 2 commits intoelastic:masterfrom
Conversation
b13a5cb to
ce9583c
Compare
PhraseSuggestionBuilder uses three smoothing models internally. In order to enable proper serialization / parsing from xContent to the phrase suggester later, this change starts by making the smoothing models writable, adding hashCode/equals and fromXContent.
There was a problem hiding this comment.
I don't understand why we need to add the type parameter to SmoothingModel, I have taken a stab at removing it here. IMO, a non-generic SmoothingModel is simpler. WDYT?
There was a problem hiding this comment.
I'm absolutely okay to remove it. I think I just added it because we used this for the abstract query builder and some other elements in past refactorings to avoid some casting, but I'm also glad to simlify it here. Will change this.
778c84c to
b81be16
Compare
|
@areek thanks for the review, I removed the type parameter from SmoothingModel, also added an aditional buildWordScorerFactory() method that we will need later in the Phrase suggesters build method. Can you take another look if this now look okay to you? |
0753398 to
920c080
Compare
There was a problem hiding this comment.
Nit: would be nice if these were explicit variables, e.g. trigramLambdaValue, bigramLambdaValue and unigramLambdaValue instead?
There was a problem hiding this comment.
Sure, pure lazyness copied over from current PhraseSuggestParser. Will change that.
|
@cbuescher this looks great, LGTM! I added a minor style comment |
Adds a method that emits a WordScorerFactory to all of the three SmoothingModel implementatins that will be needed when we switch to parsing the PhraseSuggestion on the coordinating node and need to delay creating the WordScorer on the shards.
920c080 to
aefdee1
Compare
Enable Writeable serialization and parsing from xContent for SmoothingModels
PhraseSuggestionBuilder uses three smoothing models internally. In order to enable proper serialization / parsing from xContent to the phrase suggester for the search builder refactoring, this change starts by making the smoothing models writable, adding hashCode/equals and fromXContent.