Skip to content
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

rename _toQuery() to toQuery() #760

Merged
merged 3 commits into from
Dec 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved. If you're bored and care about my nits I would quote all methods ;)

### 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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we implement this one in terms of the other so we don't duplicate code? The JIT will optimize it away anyway.

Copy link
Contributor Author

@channel-dante channel-dante Dec 8, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've seen it being used elsewhere in code from this repository. The intention was to provide reference for internal code writers. I think it would be okay to remove it if you don't want it.

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
Loading