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 <dante@channel.io>

* update CHANGELOG.md

Signed-off-by: channel-dante <dante@channel.io>

* update CHANGELOG.md

Signed-off-by: channel-dante <dante@channel.io>

---------

Signed-off-by: channel-dante <dante@channel.io>
  • Loading branch information
channel-dante authored Dec 8, 2023
1 parent 863518c commit b50fdb8
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 6 deletions.
6 changes: 3 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@ This section is for maintaining a changelog for all breaking changes for the cli
### Added
- Added support for icu_collation_keyword type ([#725](https://github.com/opensearch-project/opensearch-java/pull/725))
- Added support for flat_object field property ([#735](https://github.com/opensearch-project/opensearch-java/pull/735))

- Added toQuery method in Query and QueryVariant ([#760](https://github.com/opensearch-project/opensearch-java/pull/760)
### Dependencies

### Changed

### Deprecated

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

### Fixed
Expand Down Expand Up @@ -251,4 +251,4 @@ This section is for maintaining a changelog for all breaking changes for the cli
[2.5.0]: https://github.com/opensearch-project/opensearch-java/compare/v2.4.0...v2.5.0
[2.4.0]: https://github.com/opensearch-project/opensearch-java/compare/v2.3.0...v2.4.0
[2.3.0]: https://github.com/opensearch-project/opensearch-java/compare/v2.2.0...v2.3.0
[2.2.0]: https://github.com/opensearch-project/opensearch-java/compare/v2.1.0...v2.2.0
[2.2.0]: https://github.com/opensearch-project/opensearch-java/compare/v2.1.0...v2.2.0
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 b50fdb8

Please sign in to comment.