pub struct VectorCollection {
pub name: String,
pub dimension: usize,
pub metric: DistanceMetric,
/* private fields */
}Expand description
Vector collection containing multiple segments
Fields§
§name: StringCollection name
dimension: usizeVector dimension
metric: DistanceMetricDistance metric
Implementations§
Source§impl VectorCollection
impl VectorCollection
Sourcepub fn new(name: impl Into<String>, dimension: usize) -> VectorCollection
pub fn new(name: impl Into<String>, dimension: usize) -> VectorCollection
Create a new collection
Sourcepub fn with_config(
name: impl Into<String>,
dimension: usize,
config: SegmentConfig,
) -> VectorCollection
pub fn with_config( name: impl Into<String>, dimension: usize, config: SegmentConfig, ) -> VectorCollection
Create with custom configuration
Sourcepub fn with_metric(self, metric: DistanceMetric) -> VectorCollection
pub fn with_metric(self, metric: DistanceMetric) -> VectorCollection
Set distance metric
Sourcepub fn segment_count(&self) -> usize
pub fn segment_count(&self) -> usize
Get segment count
Sourcepub fn insert(
&mut self,
vector: Vec<f32>,
metadata: Option<MetadataEntry>,
) -> Result<u64, VectorStoreError>
pub fn insert( &mut self, vector: Vec<f32>, metadata: Option<MetadataEntry>, ) -> Result<u64, VectorStoreError>
Insert a vector with optional metadata
Sourcepub fn insert_with_id(
&mut self,
id: u64,
vector: Vec<f32>,
metadata: Option<MetadataEntry>,
) -> Result<(), VectorStoreError>
pub fn insert_with_id( &mut self, id: u64, vector: Vec<f32>, metadata: Option<MetadataEntry>, ) -> Result<(), VectorStoreError>
Insert with a specific ID
Sourcepub fn get_metadata(&self, id: u64) -> Option<&MetadataEntry>
pub fn get_metadata(&self, id: u64) -> Option<&MetadataEntry>
Get metadata for a vector
Sourcepub fn search(&self, query: &[f32], k: usize) -> Vec<SearchResult>
pub fn search(&self, query: &[f32], k: usize) -> Vec<SearchResult>
Search for k nearest neighbors
Sourcepub fn search_with_filter(
&self,
query: &[f32],
k: usize,
filter: Option<&MetadataFilter>,
) -> Vec<SearchResult>
pub fn search_with_filter( &self, query: &[f32], k: usize, filter: Option<&MetadataFilter>, ) -> Vec<SearchResult>
Search with metadata filter
Sourcepub fn seal_growing(&mut self)
pub fn seal_growing(&mut self)
Seal the current growing segment
Trait Implementations§
Source§impl VectorIndex for VectorCollection
impl VectorIndex for VectorCollection
Source§fn search(&self, query: &DenseVector, k: usize) -> Vec<SearchResult>
fn search(&self, query: &DenseVector, k: usize) -> Vec<SearchResult>
Search for k nearest neighbors
Source§fn search_with_params(
&self,
query: &DenseVector,
k: usize,
_n_probes: Option<usize>,
) -> Vec<SearchResult>
fn search_with_params( &self, query: &DenseVector, k: usize, _n_probes: Option<usize>, ) -> Vec<SearchResult>
Search with optional parameters
Source§fn distance_metric(&self) -> DistanceMetric
fn distance_metric(&self) -> DistanceMetric
Get distance metric
Auto Trait Implementations§
impl !Freeze for VectorCollection
impl RefUnwindSafe for VectorCollection
impl Send for VectorCollection
impl Sync for VectorCollection
impl Unpin for VectorCollection
impl UnsafeUnpin for VectorCollection
impl UnwindSafe for VectorCollection
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request