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

Include aggregations and suggest in SearchTemplateResponse #462

Merged
merged 4 commits into from
May 2, 2023

Conversation

eNorby1
Copy link
Contributor

@eNorby1 eNorby1 commented Apr 25, 2023

Description

Added support for aggregations and suggest in SearchTemplateResponse

Issues Resolved

Resolves #456

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

Signed-off-by: Norbert Érsek <enorby1@gmail.com>
Copy link
Member

@dblock dblock left a comment

Choose a reason for hiding this comment

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

This is great! Just needs tests that exercise this code, please.

@eNorby1
Copy link
Contributor Author

eNorby1 commented Apr 26, 2023

On it. Actually I think I found a better way of implementing it as well. Inspired by MsearchTemplateResponse, that simply extends the MultiSearchResult, there is no reason we can't do the same for the regular SearchTemplateResponses (extend SearchResponse). Would keep the responses consistent, as well as get rid of duplicate code. Will update the PR soon.

Signed-off-by: Norbert Érsek <enorby1@gmail.com>
@eNorby1 eNorby1 requested a review from dblock April 26, 2023 12:59
@eNorby1
Copy link
Contributor Author

eNorby1 commented Apr 28, 2023

Hi @dblock and others, can you please check? :)

dblock
dblock previously approved these changes Apr 28, 2023
Copy link
Member

@dblock dblock left a comment

Choose a reason for hiding this comment

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

This looks great! Super idea. I don't see any downsides, @reta?

@reta
Copy link
Collaborator

reta commented May 1, 2023

This looks great! Super idea. I don't see any downsides, @reta?

@eNorby1 I really like the direction you ended up at, I would suggest minor design change: introduce intermediary SearchResult<TDocument> class so both SearchResponse and SearchTemplateResponse could inherit from it.

Why I am suggesting that instead of subclassing SearchResponse directly: besides the fact that SearchTemplateResponse hides some static fields of the SearchResponse (not a big deal but could be surprising), the change gives an impression thatSearchTemplateResponse is not really needed and SearchResponse could be used instead (with intermediary class we basically inherit implementation only).

@eNorby1
Copy link
Contributor Author

eNorby1 commented May 1, 2023

@reta makes sense. I'll have a look, thanks

@eNorby1
Copy link
Contributor Author

eNorby1 commented May 2, 2023

Hi @reta I did the change you suggested, can you please check?

@eNorby1 eNorby1 requested a review from dblock May 2, 2023 08:40
Signed-off-by: Norbert Érsek <enorby1@gmail.com>
@reta
Copy link
Collaborator

reta commented May 2, 2023

Hi @reta I did the change you suggested, can you please check?

Thanks a lot @eNorby1 , it looks great, nit comment regarding the copyright header, LGTM otherwise!

Signed-off-by: Norbert Érsek <enorby1@gmail.com>
@VachaShah VachaShah merged commit 81ed75c into opensearch-project:main May 2, 2023
@VachaShah VachaShah added the backport 2.x Backport to 2.x branch label May 2, 2023
opensearch-trigger-bot bot pushed a commit that referenced this pull request May 2, 2023
* Include aggregations and suggest in SearchTemplateResponse

Signed-off-by: Norbert Érsek <enorby1@gmail.com>

* make SearchTemplateResponse extend SearchResponse, add test cases

Signed-off-by: Norbert Érsek <enorby1@gmail.com>

* Introduce intermediary SearchResult class

Signed-off-by: Norbert Érsek <enorby1@gmail.com>

* Fix copyright header of new class

Signed-off-by: Norbert Érsek <enorby1@gmail.com>

---------

Signed-off-by: Norbert Érsek <enorby1@gmail.com>
(cherry picked from commit 81ed75c)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
reta pushed a commit that referenced this pull request May 4, 2023
…onse (#468)

* Include aggregations and suggest in SearchTemplateResponse (#462)

* Include aggregations and suggest in SearchTemplateResponse

Signed-off-by: Norbert Érsek <enorby1@gmail.com>

* make SearchTemplateResponse extend SearchResponse, add test cases

Signed-off-by: Norbert Érsek <enorby1@gmail.com>

* Introduce intermediary SearchResult class

Signed-off-by: Norbert Érsek <enorby1@gmail.com>

* Fix copyright header of new class

Signed-off-by: Norbert Érsek <enorby1@gmail.com>

---------

Signed-off-by: Norbert Érsek <enorby1@gmail.com>
(cherry picked from commit 81ed75c)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* fix integration test for backporting

Signed-off-by: Norbert Érsek <enorby1@gmail.com>

---------

Signed-off-by: Norbert Érsek <enorby1@gmail.com>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport 2.x Backport to 2.x branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FEATURE] SearchTemplateResponse should include aggregations and suggest
4 participants