Skip to content

Conversation

AnneMayor
Copy link
Contributor

@AnneMayor AnneMayor commented Sep 21, 2025

This PR implements a partial feature to validate the code conventions and assess the impact scope. If this approach aligns with the project's direction, I will proceed with implementing the remaining functionality.

Please review and let me know if this is the right approach.

AS-IS

no support for redis 8 vector set

TO-BE

add feature vAdd of redis 8 vector set for Jedis
partially resolved #3153

Next Step

  • Add support for Lettuce
  • Implement other features of redis 8 vector set

  • You have read the Spring Data contribution guidelines.
  • You use the code formatters provided here and have them applied to your changes. Don’t submit any formatting related changes.
  • You submit test cases (unit or integration tests) that back your changes.
  • You added yourself as author in the headers of the classes you touched. Amend the date range in the Apache license header if needed. For new types, add the license header (copy from another file and set the current year only).

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Sep 21, 2025
@AnneMayor AnneMayor force-pushed the feat/support-for-redis-8-vector-sets branch from a6f4df4 to c6f326a Compare September 21, 2025 13:40
@mp911de mp911de added type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged labels Sep 22, 2025
@AnneMayor
Copy link
Contributor Author

@mp911de I am going to go on the next step. Pleaes, let me know if I have to switch my PR direction.

Copy link
Member

@mp911de mp911de left a comment

Choose a reason for hiding this comment

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

I went over the PR initially and left a few comments. The general direction looks neat, we should also have a reactive implementation and we have to make up our mind how we want to surface Vector sets from the Template API.

* @param options the options for the command
* @return true if the element was added, false if it already existed
*/
Boolean vAdd(byte @NonNull [] key, byte @NonNull [] values, byte @NonNull [] element, VAddOptions options);
Copy link
Member

Choose a reason for hiding this comment

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

values should be named vector to indicate better what this API method is about. VAddOptions can be explicitly @Nullable

* @param options the options for the command
* @return true if the element was added, false if it already existed
*/
Boolean vAdd(byte @NonNull [] key, double @NonNull [] values, byte @NonNull [] element, VAddOptions options);
Copy link
Member

Choose a reason for hiding this comment

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

Please rename values to vector. We do have a specific Vector type in Spring Data Commons and it would make sense to use that one as well as separate method. In fact, this vAdd method could be turned into a default method using Vector.unsafe(double[]) and delegate to the method accepting Vector.

this.maxConnections = builder.maxConnections;
}

public static Builder builder() {
Copy link
Member

Choose a reason for hiding this comment

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

We typically don't use builders (see XAddOptions).

return target;
}

private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
Copy link
Member

Choose a reason for hiding this comment

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

Let's not introduce a mandatory dependency on Jackson.

Assert.notNull(values, "Values must not be null");
Assert.notNull(element, "Element must not be null");

// TODO: Implement when Lettuce adds native support for V.ADD
Copy link
Member

Choose a reason for hiding this comment

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

Lettuce 6.7 has support for Vector sets.

Copy link
Contributor

@tishun tishun Oct 1, 2025

Choose a reason for hiding this comment

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

FWIW the API surface in 6.7 is still in experimental state.
There are some pending changes that need to be addressed before we can promote it.
See redis/lettuce#3459

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the feedback! I’ll double-check and update the PR if needed.

private final boolean cas;
private final QuantizationType quantization;
private final @Nullable Integer efBuildFactor;
private final @Nullable Map<String, Object> attributes;
Copy link
Member

Choose a reason for hiding this comment

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

Let's keep attributes opaque and make it a String without us being involved in JSON serialization for the time being.

@AnneMayor
Copy link
Contributor Author

I went over the PR initially and left a few comments. The general direction looks neat, we should also have a reactive implementation and we have to make up our mind how we want to surface Vector sets from the Template API.

Thank you for your comments. I am gonna address your comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement A general enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for Redis 8 Vector Sets
4 participants