Trait VectorSetCommands

Source
pub trait VectorSetCommands<'a> {
Show 13 methods // Provided methods fn vadd<K, E>( self, key: K, reduce_dim: Option<usize>, values: &[f32], element: E, options: VAddOptions, ) -> PreparedCommand<'a, Self, bool> where Self: Sized, K: SingleArg, E: SingleArg { ... } fn vcard<K>(self, key: K) -> PreparedCommand<'a, Self, usize> where Self: Sized, K: SingleArg { ... } fn vdim<K>(self, key: K) -> PreparedCommand<'a, Self, usize> where Self: Sized, K: SingleArg { ... } fn vemb<K, E, R>(self, key: K, element: E) -> PreparedCommand<'a, Self, R> where Self: Sized, K: SingleArg, E: SingleArg, R: CollectionResponse<f32> { ... } fn vgetattr<K, E, R>( self, key: K, element: E, ) -> PreparedCommand<'a, Self, R> where Self: Sized, K: SingleArg, E: SingleArg, R: Response { ... } fn vinfo<K>(self, key: K) -> PreparedCommand<'a, Self, VInfoResult> where Self: Sized, K: SingleArg { ... } fn vlinks<K, E, R, RR>( self, key: K, element: E, ) -> PreparedCommand<'a, Self, RR> where Self: Sized, K: SingleArg, E: SingleArg, R: Response + DeserializeOwned, RR: CollectionResponse<R> + DeserializeOwned { ... } fn vlinks_with_score<K, E, R, RR>( self, key: K, element: E, ) -> PreparedCommand<'a, Self, RR> where Self: Sized, K: SingleArg, E: SingleArg, R: PrimitiveResponse + DeserializeOwned, RR: KeyValueCollectionResponse<R, f64> + DeserializeOwned { ... } fn vrandmember<K, R, RR>( self, key: K, count: isize, ) -> PreparedCommand<'a, Self, RR> where Self: Sized, K: SingleArg, R: PrimitiveResponse + DeserializeOwned, RR: CollectionResponse<R> + DeserializeOwned { ... } fn vrem<K, E>(self, key: K, element: E) -> PreparedCommand<'a, Self, bool> where Self: Sized, K: SingleArg, E: SingleArg { ... } fn vsetattr<K, E, J>( self, key: K, element: E, json: J, ) -> PreparedCommand<'a, Self, bool> where Self: Sized, K: SingleArg, E: SingleArg, J: SingleArg { ... } fn vsim<K, R, RR>( self, key: K, vector_or_element: VectorOrElement<'_>, options: VSimOptions, ) -> PreparedCommand<'a, Self, RR> where Self: Sized, K: SingleArg, R: PrimitiveResponse + DeserializeOwned, RR: CollectionResponse<R> + DeserializeOwned { ... } fn vsim_with_scores<K, RF, R>( self, key: K, vector_or_element: VectorOrElement<'_>, options: VSimOptions, ) -> PreparedCommand<'a, Self, R> where Self: Sized, K: SingleArg, RF: PrimitiveResponse + DeserializeOwned, R: KeyValueCollectionResponse<RF, f64> + DeserializeOwned { ... }
}
Expand description

A group of Redis commands related to Vector Sets

§See Also

Redis Sorted Set Commands

Provided Methods§

Source

fn vadd<K, E>( self, key: K, reduce_dim: Option<usize>, values: &[f32], element: E, options: VAddOptions, ) -> PreparedCommand<'a, Self, bool>
where Self: Sized, K: SingleArg, E: SingleArg,

Add a new element into the vector set specified by key.

The vector can be provided as 32-bit floating point (FP32) blob of values, or as floating point numbers as strings

§Arguments
  • key - is the name of the key that will hold the vector set data.
  • reduce_dim - implements random projection to reduce the dimensionality of the vector. The projection matrix is saved and reloaded along with the vector set.
  • values - vector values.
  • element - is the name of the element that is being added to the vector set.
§Return
  • true - if key was added.
  • false - if key was not added.
§See Also

https://redis.io/commands/vadd/

Source

fn vcard<K>(self, key: K) -> PreparedCommand<'a, Self, usize>
where Self: Sized, K: SingleArg,

Return the number of elements in the specified vector set.

§See Also

https://redis.io/commands/vcard/

Source

fn vdim<K>(self, key: K) -> PreparedCommand<'a, Self, usize>
where Self: Sized, K: SingleArg,

Return the number of dimensions of the vectors in the specified vector set.

§See Also

https://redis.io/commands/vdim/

Source

fn vemb<K, E, R>(self, key: K, element: E) -> PreparedCommand<'a, Self, R>
where Self: Sized, K: SingleArg, E: SingleArg, R: CollectionResponse<f32>,

Return the approximate vector associated with a given element in the vector set.

§See Also

https://redis.io/commands/vemb/

Source

fn vgetattr<K, E, R>(self, key: K, element: E) -> PreparedCommand<'a, Self, R>
where Self: Sized, K: SingleArg, E: SingleArg, R: Response,

Return the JSON attributes associated with an element in a vector set.

§See Also

https://redis.io/commands/vemb/

Source

fn vinfo<K>(self, key: K) -> PreparedCommand<'a, Self, VInfoResult>
where Self: Sized, K: SingleArg,

Return metadata and internal details about a vector set, including size, dimensions, quantization type, and graph structure.

§See Also

https://redis.io/commands/vinfo/

Return the neighbors of a specified element in a vector set. The command shows the connections for each layer of the HNSW graph.

§Return

a collection containing the names of adjacent elements

§See Also

https://redis.io/commands/vlinks/

Return the neighbors of a specified element in a vector set. The command shows the connections for each layer of the HNSW graph.

§Return

a collection containing the names of adjacent elements together with their scores as doubles

§See Also

https://redis.io/commands/vlinks/

Source

fn vrandmember<K, R, RR>( self, key: K, count: isize, ) -> PreparedCommand<'a, Self, RR>

Return one or more random elements from a vector set.

The behavior is similar to the SRANDMEMBER command:

  • When called without a count, returns a single element as a bulk string.
  • When called with a positive count, returns up to that many distinct elements (no duplicates).
  • When called with a negative count, returns that many elements, possibly with duplicates.
  • If the count exceeds the number of elements, the entire set is returned.
  • If the key does not exist, the command returns null if no count is given, or an empty array if a count is provided.
§Return

a collecton containing the names of count random elements as strings.

§See Also

https://redis.io/commands/vrandmember/

Source

fn vrem<K, E>(self, key: K, element: E) -> PreparedCommand<'a, Self, bool>
where Self: Sized, K: SingleArg, E: SingleArg,

Remove an element from a vector set.

§Return
  • true - if the element was removed.
  • false - if either element or key do not exist.

VREM reclaims memory immediately. It does not use tombstones or logical deletions, making it safe to use in long-running applications that frequently update the same vector set.

§See Also

https://redis.io/commands/vrem/

Source

fn vsetattr<K, E, J>( self, key: K, element: E, json: J, ) -> PreparedCommand<'a, Self, bool>
where Self: Sized, K: SingleArg, E: SingleArg, J: SingleArg,

Associate a JSON object with an element in a vector set.

Use this command to store attributes that can be used in filtered similarity searches with VSIM.

You can also update existing attributes or delete them by setting an empty string.

§See Also

https://redis.io/commands/vemb/

Source

fn vsim<K, R, RR>( self, key: K, vector_or_element: VectorOrElement<'_>, options: VSimOptions, ) -> PreparedCommand<'a, Self, RR>

Return elements similar to a given vector or element. Use this command to perform approximate or exact similarity searches within a vector set.

§See Also

https://redis.io/commands/vsim/

Source

fn vsim_with_scores<K, RF, R>( self, key: K, vector_or_element: VectorOrElement<'_>, options: VSimOptions, ) -> PreparedCommand<'a, Self, R>

Return elements similar to a given vector or element. Use this command to perform approximate or exact similarity searches within a vector set.

§See Also

https://redis.io/commands/vsim/

Implementors§

Source§

impl<'a> VectorSetCommands<'a> for &'a Client

Source§

impl<'a> VectorSetCommands<'a> for &'a Pipeline<'_>

Source§

impl<'a> VectorSetCommands<'a> for &'a Transaction