-
Notifications
You must be signed in to change notification settings - Fork 190
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
TermvectorsResponse fix for optionals. #642
Changes from 2 commits
08297be
06a0685
aa5e13f
ecded52
e2e8386
37d02d8
ffb3c55
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -62,7 +62,7 @@ public class TermvectorsResponse implements JsonpSerializable { | |
|
||
private final long took; | ||
|
||
private final long version; | ||
private final Long version; | ||
|
||
// --------------------------------------------------------------------------------------------- | ||
|
||
|
@@ -73,7 +73,7 @@ private TermvectorsResponse(Builder builder) { | |
this.index = ApiTypeHelper.requireNonNull(builder.index, this, "index"); | ||
this.termVectors = ApiTypeHelper.unmodifiable(builder.termVectors); | ||
this.took = ApiTypeHelper.requireNonNull(builder.took, this, "took"); | ||
this.version = ApiTypeHelper.requireNonNull(builder.version, this, "version"); | ||
this.version = builder.version; | ||
|
||
} | ||
|
||
|
@@ -157,8 +157,10 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { | |
generator.writeKey("took"); | ||
generator.write(this.took); | ||
|
||
generator.writeKey("_version"); | ||
generator.write(this.version); | ||
if (null != this.version) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Tabs vs. spaces looks suspicious here. Also surprised spotless didn't catch it, mind checking please? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this optional? Maybe add a test? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You have right. According to the server sources https://github.com/opensearch-project/OpenSearch/blob/7dc6683838951e1a211c6ff634d9eea93e2be3c2/server/src/main/java/org/opensearch/action/termvectors/TermVectorsResponse.java#L205 _version is still delivered. |
||
generator.writeKey("_version"); | ||
generator.write(this.version); | ||
} | ||
|
||
} | ||
|
||
|
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.
Let's make this look like the other lines. Say
Fix ...
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.
Done.