Skip to content

Commit

Permalink
fix unit test
Browse files Browse the repository at this point in the history
Signed-off-by: Junwei Dai <[email protected]>
  • Loading branch information
Junwei Dai committed Jan 22, 2025
1 parent 2c16992 commit 42e50d0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ public static HighlightBuilder highlight() {

private String searchPipeline;

private Boolean verbosePipeline;
private boolean verbosePipeline = false;

/**
* Constructs a new search source builder.
Expand Down Expand Up @@ -306,7 +306,7 @@ public SearchSourceBuilder(StreamInput in) throws IOException {
searchPipeline = in.readOptionalString();
}
if (in.getVersion().onOrAfter(Version.V_3_0_0)) {
verbosePipeline = in.readOptionalBoolean();
verbosePipeline = in.readBoolean();
}
}

Expand Down Expand Up @@ -392,7 +392,7 @@ public void writeTo(StreamOutput out) throws IOException {
out.writeOptionalString(searchPipeline);
}
if (out.getVersion().onOrAfter(Version.V_3_0_0)) {
out.writeOptionalBoolean(verbosePipeline);
out.writeBoolean(verbosePipeline);
}
}

Expand Down Expand Up @@ -1162,7 +1162,7 @@ public SearchSourceBuilder pipeline(String searchPipeline) {
* to track how data flows and transforms through the search pipeline.
*
*/
public SearchSourceBuilder verbosePipeline(boolean verbosePipeline) {
public SearchSourceBuilder verbosePipeline(Boolean verbosePipeline) {
this.verbosePipeline = verbosePipeline;
return this;
}
Expand Down Expand Up @@ -1674,7 +1674,7 @@ public XContentBuilder innerToXContent(XContentBuilder builder, Params params) t
builder.field(SEARCH_PIPELINE.getPreferredName(), searchPipeline);
}

if (verbosePipeline != null) {
if (verbosePipeline) {
builder.field(VERBOSE_SEARCH_PIPELINE.getPreferredName(), verbosePipeline);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -722,7 +722,7 @@ public void testVerbosePipeline() throws IOException {
String restContent = "{ \"query\": { \"match_all\": {} } }";
try (XContentParser parser = createParser(JsonXContent.jsonXContent, restContent)) {
SearchSourceBuilder searchSourceBuilder = SearchSourceBuilder.fromXContent(parser);
assertNull(searchSourceBuilder.verbosePipeline());
assertFalse(searchSourceBuilder.verbosePipeline());
}
}
}
Expand Down

0 comments on commit 42e50d0

Please sign in to comment.