Skip to content

Java: VSS commands init#2385

Closed
Yury-Fridlyand wants to merge 18 commits intomainfrom
java/yuryf-ft-create-search-drop
Closed

Java: VSS commands init#2385
Yury-Fridlyand wants to merge 18 commits intomainfrom
java/yuryf-ft-create-search-drop

Conversation

@Yury-Fridlyand
Copy link
Copy Markdown

@Yury-Fridlyand Yury-Fridlyand commented Oct 3, 2024

@Yury-Fridlyand Yury-Fridlyand added the java ☕ issues and fixes related to the java client label Oct 3, 2024
@Yury-Fridlyand Yury-Fridlyand requested a review from a team as a code owner October 3, 2024 00:25
compileTestJava.dependsOn('copyNativeLib')
test.dependsOn('buildRust')
testFfi.dependsOn('buildRust')
test.dependsOn('buildRustRelease')
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

why? I thought we were okay with running tests vs the debug version?

Copy link
Copy Markdown
Author

@Yury-Fridlyand Yury-Fridlyand Oct 3, 2024

Choose a reason for hiding this comment

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

gradle still runs UT on release due to copyNativeLib. At least it doesn't build debug version which is never used.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I don't know when we decided to switch to the release version. Better to run against debug, but we can fix this in a separate PR

Signed-off-by: Yury-Fridlyand <yury.fridlyand@improving.com>
@acarbonetto acarbonetto changed the title Java: VSS commans init Java: VSS commands init Oct 8, 2024
RequestType::ScriptKill => Some(get_two_word_command("SCRIPT", "KILL")),
RequestType::FtCreate => Some(cmd("FT.CREATE")),
RequestType::FtSearch => Some(cmd("FT.SEARCH")),
RequestType::FtDrop => Some(cmd("FT.DROPINDEX")),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
RequestType::FtDrop => Some(cmd("FT.DROPINDEX")),
RequestType::FtDropIndex => Some(cmd("FT.DROPINDEX")),

ProtobufRequestType::ScriptShow => RequestType::ScriptShow,
ProtobufRequestType::FtCreate => RequestType::FtCreate,
ProtobufRequestType::FtSearch => RequestType::FtSearch,
ProtobufRequestType::FtDrop => RequestType::FtDrop,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
ProtobufRequestType::FtDrop => RequestType::FtDrop,
ProtobufRequestType::FtDropIndex => RequestType::FtDropIndex,

ScriptShow = 218,
FtCreate = 2000,
FtSearch = 2001,
FtDrop = 2002,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
FtDrop = 2002,
FtDropIndex = 2002,


FtCreate = 2000;
FtSearch = 2001;
FtDrop = 2002;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
FtDrop = 2002;
FtDropIndex = 2002;

compileTestJava.dependsOn('copyNativeLib')
test.dependsOn('buildRust')
testFfi.dependsOn('buildRust')
test.dependsOn('buildRustRelease')
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I don't know when we decided to switch to the release version. Better to run against debug, but we can fix this in a separate PR

import glide.api.models.commands.vss.FTSearchOptions.FTSearchOptionsBuilder;
import java.util.concurrent.CompletableFuture;

public interface VectorSearchBaseCommands {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please change this to a Static Public Class and put it under package glide.api.commands.servermodules.
Move the commands function from BaseClient to here (add the argument BaseClient to each command).
We don't need to separate Interface and commands, and we can put the documentation in one place.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Following the JSON and FT commands, we should rename this class to FT, and commands should only reference the action. Example:

import static glide.api.models.commands. servermodules.FT;

FT.create(client, "hash_idx1", FTCreateOptions.empty(), new FieldInfo[] {
    new FieldInfo("vec", VectorFieldFlat.builder(DistanceMetric.L2, 2).build())
}).get();

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Will do after merging #2414

* client.ftdrop("hash_idx1").get();
* }</pre>
*/
CompletableFuture<String> ftdrop(String indexName);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
CompletableFuture<String> ftdrop(String indexName);
CompletableFuture<String> ftdropindex(String indexName);

var args = new ArrayList<String>();
args.add("TAG");
if (separator.isPresent()) {
args.add("SEPARATOR");
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Should these keywords be constants?

@Override
public String[] toArgs() {
var args = new ArrayList<String>();
args.add("VECTOR");
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggestion: Types TEXT, VECTOR, TAG, etc. could be Enums.

var args = new ArrayList<String>();
args.add("VECTOR");
args.add(Algorithm);
args.add(Integer.toString(params.size() * 2));
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

There is no null check for params? This is a potential null pointer exception.

*/
public static class VectorFieldHnsw extends VectorField {
protected VectorFieldHnsw(Map<String, String> params) {
super(params, "HNSW");
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

"HNSW" value can be taken from Algorithm Enum.

concatenateArrays(
new GlideString[] {gs(indexName), gs(query)},
options.toArgs(),
new GlideString[] {gs("DIALECT"), gs("2")});
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I don't see this option in the inputs.

@Yury-Fridlyand
Copy link
Copy Markdown
Author

Superseded by #2414, #2439 and #2440

@Yury-Fridlyand Yury-Fridlyand deleted the java/yuryf-ft-create-search-drop branch October 11, 2024 18:45
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.

4 participants