Skip to content

Commit

Permalink
rename _toQuery() to toQuery() (opensearch-project#760)
Browse files Browse the repository at this point in the history
* rename _toQuery() to toQuery()

Signed-off-by: channel-dante <[email protected]>

* update CHANGELOG.md

Signed-off-by: channel-dante <[email protected]>

* update CHANGELOG.md

Signed-off-by: channel-dante <[email protected]>

---------

Signed-off-by: channel-dante <[email protected]>

(cherry picked from commit b50fdb8)
Signed-off-by: channel-dante <[email protected]>
  • Loading branch information
channel-dante committed Jan 4, 2024
1 parent 339c16c commit c3cb5e2
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 3 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- Added support for flat_object field property ([#735](https://github.com/opensearch-project/opensearch-java/pull/735))
- Expose HTTP status code through `ResponseException#status` ([#756](https://github.com/opensearch-project/opensearch-java/pull/756))
- Added toBuilder method to all request model in core package & _types.query_dsl package ([#766](https://github.com/opensearch-project/opensearch-java/pull/766))
- Added toQuery method in Query and QueryVariant ([#760](https://github.com/opensearch-project/opensearch-java/pull/760)

### Dependencies
- Bumps `com.diffplug.spotless` from 6.22.0 to 6.23.3
Expand All @@ -15,6 +16,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
### Changed

### Deprecated
- Deprecated "_toQuery()" in Query and QueryVariant ([#760](https://github.com/opensearch-project/opensearch-java/pull/760)

### Removed

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,12 @@ public interface QueryVariant {

Query.Kind _queryKind();

@Deprecated
default Query _toQuery() {
return new Query(this);
}

default Query toQuery() {
return new Query(this);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,14 @@
public class Query implements TaggedUnion<Query.Kind, Query.Variant>, JsonpSerializable {

public interface Variant extends UnionVariant<Kind>, JsonpSerializable {
@Deprecated
default Query _toQuery() {
return new Query(this);
}

default Query toQuery() {
return new Query(this);
}
}

public enum Kind implements JsonEnum {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public void testQuery() {
Query.Variant v = q._get();
assertEquals(Query.Kind.Bool, v._variantType());

Query q1 = v._toQuery();
Query q1 = v.toQuery();

Collection<Query> must = q.bool().must();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -495,9 +495,9 @@ public void testSubAggregation() throws IOException {
.filter(
BoolQuery.of(
_5 -> _5.filter(
List.of(TermsQuery.of(_6 -> _6.field("color.keyword").terms(_7 -> _7.value(fieldValues)))._toQuery())
List.of(TermsQuery.of(_6 -> _6.field("color.keyword").terms(_7 -> _7.value(fieldValues))).toQuery())
)
)._toQuery()
).toQuery()
)
)
);
Expand Down

0 comments on commit c3cb5e2

Please sign in to comment.