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

use _toQuery() when combining queries #716

Closed
channel-dante opened this issue Nov 7, 2023 · 2 comments
Closed

use _toQuery() when combining queries #716

channel-dante opened this issue Nov 7, 2023 · 2 comments
Labels
enhancement New feature or request

Comments

@channel-dante
Copy link
Contributor

Is your feature request related to a problem?

The _toQuery() method is often used to combine multiple queries as below.

    builder.query(BoolQuery.of(boolQueryBuilder ->
        boolQueryBuilder
            .must(must.build()._toQuery())
            .filter(should.build()._toQuery())
    )._toQuery());

What solution would you like?

Methods starting with an underscore seem like naming conventions that should only be used internally. Can I continue to use this method as above? If that's the case, could you consider removing the underscore from the method naming like (.toQuery())?

If I am using the method in the wrong way, what is the correct way to combine queries like above?

@channel-dante channel-dante added enhancement New feature or request untriaged labels Nov 7, 2023
@channel-dante channel-dante changed the title [FEATURE] rename _toQuery() use _toQuery() when combining queries Nov 7, 2023
@dblock
Copy link
Member

dblock commented Dec 4, 2023

You're probably using it right. I suggest we deprecate _toQuery() and rename it to toQuery, WDYT? Want to contribute?

@channel-dante
Copy link
Contributor Author

I'll close it because I understand the intent and the code has been merged(#760) to improve it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants