public class VectorMetadata extends Object
This class encapsulates information returned by the Redis VINFO command, including size, dimensions, quantization type, and graph structure parameters of a vector set.
Vector sets are a Redis data type designed for storing and searching high-dimensional vectors. They support approximate nearest neighbor search using the HNSW (Hierarchical Navigable Small World) algorithm.
The metadata provides insights into the configuration and state of a vector set, which can be useful for monitoring, debugging, and understanding the performance characteristics of vector operations.
| Constructor and Description |
|---|
VectorMetadata()
Creates a new empty
VectorMetadata instance. |
| Modifier and Type | Method and Description |
|---|---|
Integer |
getAttributesCount()
Gets the number of elements in the vector set that have attributes.
|
Integer |
getDimensionality()
Gets the dimensionality of the vectors in the vector set.
|
Integer |
getMaxLevel()
Gets the maximum level in the HNSW graph.
|
Integer |
getMaxNodes()
Gets the maximum number of connections per node in the HNSW graph.
|
Integer |
getMaxNodeUid()
Gets the maximum node UID in the HNSW graph.
|
Integer |
getProjectionInputDim()
Gets the original dimensionality of vectors before dimensionality reduction.
|
Integer |
getSize()
Gets the number of elements (vectors) in the vector set.
|
QuantizationType |
getType()
Gets the quantization type used for storing vectors in the vector set.
|
Integer |
getvSetUid()
Gets the unique identifier of the vector set.
|
void |
setAttributesCount(Integer value)
Sets the number of elements in the vector set that have attributes.
|
void |
setDimensionality(Integer value)
Sets the dimensionality of the vectors in the vector set.
|
void |
setMaxLevel(Integer value)
Sets the maximum level in the HNSW graph.
|
void |
setMaxNodes(Integer value)
Sets the maximum number of connections per node in the HNSW graph.
|
void |
setMaxNodeUid(Integer value)
Sets the maximum node UID in the HNSW graph.
|
void |
setProjectionInputDim(Integer value)
Sets the original dimensionality of vectors before dimensionality reduction.
|
void |
setSize(Integer value)
Sets the number of elements (vectors) in the vector set.
|
void |
setType(QuantizationType value)
Sets the quantization type used for storing vectors in the vector set.
|
void |
setvSetUid(Integer value)
Sets the unique identifier of the vector set.
|
public VectorMetadata()
VectorMetadata instance.
This constructor creates an empty metadata object. The fields will be populated when the object is used to parse the response from a Redis VINFO command.
public Integer getDimensionality()
This represents the number of dimensions (features) in each vector. All vectors in a vector set must have the same dimensionality. Higher dimensionality vectors can represent more complex data but require more memory and processing power.
null if not availablepublic QuantizationType getType()
Quantization affects how vectors are stored and impacts memory usage, performance, and recall quality.
Common types include:
Q8 - Uses signed 8-bit quantization, balancing memory usage and recall qualityNOQUANT - Stores vectors without quantization, using more memory but preserving full precisionBIN - Uses binary quantization, which is faster and uses less memory, but impacts recall qualitynull if not availablepublic Integer getSize()
This represents the total count of vectors currently stored in the vector set. This is equivalent to the result of the
VCARD command.
null if not availablepublic Integer getMaxNodeUid()
This is an internal identifier used by Redis to track nodes in the HNSW graph. It can be useful for debugging and monitoring purposes.
null if not availablepublic Integer getvSetUid()
This is an internal identifier used by Redis to track the vector set. It can be useful for debugging and monitoring purposes.
null if not availablepublic Integer getMaxNodes()
This parameter (also known as M) specifies the maximum number of connections that each node of the graph will have with other nodes. More connections means more memory, but provides for more efficient graph exploration.
Higher values improve recall at the cost of memory usage and indexing speed.
null if not availablepublic Integer getProjectionInputDim()
When using the REDUCE option with VADD, this field indicates the original dimensionality of the vectors before they were projected to a lower-dimensional space.
null if dimensionality reduction is not usedpublic Integer getAttributesCount()
Attributes are JSON metadata associated with vector elements that can be used for filtering in similarity searches.
null if not availablepublic Integer getMaxLevel()
The HNSW algorithm organizes vectors in a hierarchical graph with multiple levels. This parameter indicates the highest level in the graph structure.
Higher levels enable faster navigation through the graph during similarity searches.
null if not availablepublic void setDimensionality(Integer value)
value - the number of dimensions for each vector in the vector setpublic void setType(QuantizationType value)
value - the quantization type (Q8, NOQUANT, or BIN)public void setSize(Integer value)
value - the total count of vectors in the vector setpublic void setMaxNodeUid(Integer value)
This is an internal identifier used by Redis to track nodes in the HNSW graph.
value - the maximum node UID in the HNSW graphpublic void setvSetUid(Integer value)
value - the unique identifier used by Redis to track the vector setpublic void setMaxNodes(Integer value)
This parameter (also known as M) affects the memory usage and search performance of the vector set.
value - the maximum number of connections per nodepublic void setProjectionInputDim(Integer value)
This is used when the REDUCE option is specified with VADD.
value - the original dimensionality before reductionpublic void setAttributesCount(Integer value)
value - the number of elements with attributespublic void setMaxLevel(Integer value)
The HNSW algorithm organizes vectors in a hierarchical graph with multiple levels. Higher levels enable faster navigation through the graph during similarity searches.
Corresponds to the max-level field in the VINFO command response.
value - the maximum level in the HNSW graphCopyright © 2025 lettuce.io. All rights reserved.