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

Java: FT.EXPLAIN and FT.EXPLAINCLI #2515

Merged
merged 16 commits into from
Oct 28, 2024

Conversation

cyip10
Copy link
Collaborator

@cyip10 cyip10 commented Oct 24, 2024

Issue link

This Pull Request is linked to issue (URL): #2428

Checklist

Before submitting the PR make sure the following are checked:

  • This Pull Request is related to one issue.
  • Commit message has a detailed description of what changed and why.
  • Tests are added or updated.
  • CHANGELOG.md and documentation files are updated.
  • Destination branch is correct - main or release
  • Commits will be squashed upon merging.

Signed-off-by: Chloe <chloe.yip@improving.com>
Signed-off-by: Chloe Yip <chloe.yip@improving.com>
Signed-off-by: Chloe <chloe.yip@improving.com>
@cyip10 cyip10 added the java issues and fixes related to the java client label Oct 24, 2024
@cyip10 cyip10 requested a review from a team as a code owner October 24, 2024 22:04
Signed-off-by: Chloe <chloe.yip@improving.com>
Signed-off-by: Chloe <chloe.yip@improving.com>
Signed-off-by: Chloe <chloe.yip@improving.com>
Signed-off-by: Chloe <chloe.yip@improving.com>
Signed-off-by: Chloe <chloe.yip@improving.com>
Signed-off-by: Chloe <chloe.yip@improving.com>
@Yury-Fridlyand Yury-Fridlyand mentioned this pull request Oct 28, 2024
13 tasks
Signed-off-by: Chloe <chloe.yip@improving.com>
*/
public static CompletableFuture<String> explain(
@NonNull BaseClient client, @NonNull String indexName, @NonNull String query) {
var args = concatenateArrays(new GlideString[] {gs("FT.EXPLAIN"), gs(indexName), gs(query)});
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
var args = concatenateArrays(new GlideString[] {gs("FT.EXPLAIN"), gs(indexName), gs(query)});
GlideString[] args = new GlideString[] {gs("FT.EXPLAIN"), gs(indexName), gs(query)};

concatenateArrays() is not needed, as we are creating only one array. Also try not to use var.
Please check all other occurences as well.

// search query that returns all data.
resultGS = FT.explaincli(client, gs(indexName), gs("*")).get();
for (GlideString r : resultGS) {
resultListGS2.add(r.toString().trim()); // trim to remove any excess white space
Copy link
Collaborator

Choose a reason for hiding this comment

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

why not using stream again here with resultListGS2?

}

@SneakyThrows
public void createIndexHelper(String indexName) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

If this is a helper/utility method, then maybe it doesn't need to be public.

Signed-off-by: Andrew Carbonetto <andrew.carbonetto@improving.com>
Signed-off-by: Andrew Carbonetto <andrew.carbonetto@improving.com>
Copy link
Collaborator

@Yury-Fridlyand Yury-Fridlyand left a comment

Choose a reason for hiding this comment

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

LGTM, last nits

Signed-off-by: Andrew Carbonetto <andrew.carbonetto@improving.com>
@Yury-Fridlyand Yury-Fridlyand merged commit ddca067 into release-1.2 Oct 28, 2024
14 checks passed
@Yury-Fridlyand Yury-Fridlyand deleted the java/cyip10_vss_explain_explaincli branch October 28, 2024 23:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
java issues and fixes related to the java client
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants