pub struct VelesCollection { /* private fields */ }Expand description
A collection of vectors with associated metadata.
Implementations§
Source§impl VelesCollection
impl VelesCollection
Sourcepub fn search(
&self,
vector: Vec<f32>,
limit: u32,
) -> Result<Vec<SearchResult>, VelesError>
pub fn search( &self, vector: Vec<f32>, limit: u32, ) -> Result<Vec<SearchResult>, VelesError>
Sourcepub fn upsert(&self, point: VelesPoint) -> Result<(), VelesError>
pub fn upsert(&self, point: VelesPoint) -> Result<(), VelesError>
Sourcepub fn upsert_batch(&self, points: Vec<VelesPoint>) -> Result<(), VelesError>
pub fn upsert_batch(&self, points: Vec<VelesPoint>) -> Result<(), VelesError>
Sourcepub fn get_by_id(&self, id: u64) -> Option<VelesPoint>
pub fn get_by_id(&self, id: u64) -> Option<VelesPoint>
Sourcepub fn is_metadata_only(&self) -> bool
pub fn is_metadata_only(&self) -> bool
Checks if this is a metadata-only collection.
Sourcepub fn text_search(&self, query: String, limit: u32) -> Vec<SearchResult>
pub fn text_search(&self, query: String, limit: u32) -> Vec<SearchResult>
Sourcepub fn hybrid_search(
&self,
vector: Vec<f32>,
text_query: String,
limit: u32,
vector_weight: f32,
) -> Result<Vec<SearchResult>, VelesError>
pub fn hybrid_search( &self, vector: Vec<f32>, text_query: String, limit: u32, vector_weight: f32, ) -> Result<Vec<SearchResult>, VelesError>
Performs hybrid search combining vector similarity and BM25 text search.
§Arguments
vector- Query vector for similarity searchtext_query- Text query for BM25 searchlimit- Maximum number of resultsvector_weight- Weight for vector similarity (0.0-1.0)
§Returns
Vector of search results sorted by fused score.
Sourcepub fn search_with_filter(
&self,
vector: Vec<f32>,
limit: u32,
filter_json: String,
) -> Result<Vec<SearchResult>, VelesError>
pub fn search_with_filter( &self, vector: Vec<f32>, limit: u32, filter_json: String, ) -> Result<Vec<SearchResult>, VelesError>
Sourcepub fn batch_search(
&self,
searches: Vec<IndividualSearchRequest>,
) -> Result<Vec<Vec<SearchResult>>, VelesError>
pub fn batch_search( &self, searches: Vec<IndividualSearchRequest>, ) -> Result<Vec<Vec<SearchResult>>, VelesError>
Sourcepub fn text_search_with_filter(
&self,
query: String,
limit: u32,
filter_json: String,
) -> Result<Vec<SearchResult>, VelesError>
pub fn text_search_with_filter( &self, query: String, limit: u32, filter_json: String, ) -> Result<Vec<SearchResult>, VelesError>
Performs text search with metadata filtering.
§Arguments
query- Text querylimit- Maximum number of resultsfilter_json- JSON filter string
Sourcepub fn hybrid_search_with_filter(
&self,
vector: Vec<f32>,
text_query: String,
limit: u32,
vector_weight: f32,
filter_json: String,
) -> Result<Vec<SearchResult>, VelesError>
pub fn hybrid_search_with_filter( &self, vector: Vec<f32>, text_query: String, limit: u32, vector_weight: f32, filter_json: String, ) -> Result<Vec<SearchResult>, VelesError>
Performs hybrid search with metadata filtering.
§Arguments
vector- Query vectortext_query- Text querylimit- Maximum number of resultsvector_weight- Weight for vector similarity (0.0-1.0)filter_json- JSON filter string
Sourcepub fn query(
&self,
query_str: String,
params_json: Option<String>,
) -> Result<Vec<SearchResult>, VelesError>
pub fn query( &self, query_str: String, params_json: Option<String>, ) -> Result<Vec<SearchResult>, VelesError>
Sourcepub fn multi_query_search(
&self,
vectors: Vec<Vec<f32>>,
limit: u32,
strategy: FusionStrategy,
) -> Result<Vec<SearchResult>, VelesError>
pub fn multi_query_search( &self, vectors: Vec<Vec<f32>>, limit: u32, strategy: FusionStrategy, ) -> Result<Vec<SearchResult>, VelesError>
Performs multi-query search with result fusion.
Executes parallel searches for multiple query vectors and fuses results using the specified strategy. Ideal for Multiple Query Generation (MQG) pipelines on mobile.
§Arguments
vectors- List of query vectorslimit- Maximum number of results after fusionstrategy- Fusion strategy to use
§Returns
Vector of fused search results sorted by relevance.
§Example
let results = try collection.multiQuerySearch(
vectors: [query1, query2, query3],
limit: 10,
strategy: .rrf(k: 60)
)Sourcepub fn multi_query_search_with_filter(
&self,
vectors: Vec<Vec<f32>>,
limit: u32,
strategy: FusionStrategy,
filter_json: String,
) -> Result<Vec<SearchResult>, VelesError>
pub fn multi_query_search_with_filter( &self, vectors: Vec<Vec<f32>>, limit: u32, strategy: FusionStrategy, filter_json: String, ) -> Result<Vec<SearchResult>, VelesError>
Performs multi-query search with metadata filtering.
§Arguments
vectors- List of query vectorslimit- Maximum number of results after fusionstrategy- Fusion strategy to usefilter_json- JSON filter string
Sourcepub fn flush(&self) -> Result<(), VelesError>
pub fn flush(&self) -> Result<(), VelesError>
Flushes collection data to durable storage.
Sourcepub fn create_index(&self, field_name: String) -> Result<(), VelesError>
pub fn create_index(&self, field_name: String) -> Result<(), VelesError>
Creates a secondary metadata index for a payload field.
Sourcepub fn has_secondary_index(&self, field_name: String) -> bool
pub fn has_secondary_index(&self, field_name: String) -> bool
Checks whether a secondary metadata index exists for a field.
Sourcepub fn create_property_index(
&self,
label: String,
property: String,
) -> Result<(), VelesError>
pub fn create_property_index( &self, label: String, property: String, ) -> Result<(), VelesError>
Creates a graph/property index for equality lookups.
Sourcepub fn create_range_index(
&self,
label: String,
property: String,
) -> Result<(), VelesError>
pub fn create_range_index( &self, label: String, property: String, ) -> Result<(), VelesError>
Creates a graph/range index for range queries.
Sourcepub fn has_property_index(&self, label: String, property: String) -> bool
pub fn has_property_index(&self, label: String, property: String) -> bool
Checks if a property index exists.
Sourcepub fn has_range_index(&self, label: String, property: String) -> bool
pub fn has_range_index(&self, label: String, property: String) -> bool
Checks if a range index exists.
Sourcepub fn list_indexes(&self) -> Vec<MobileIndexInfo>
pub fn list_indexes(&self) -> Vec<MobileIndexInfo>
Lists all index definitions on this collection.
Sourcepub fn drop_index(
&self,
label: String,
property: String,
) -> Result<bool, VelesError>
pub fn drop_index( &self, label: String, property: String, ) -> Result<bool, VelesError>
Drops an index and returns true when something was removed.
Sourcepub fn indexes_memory_usage(&self) -> u64
pub fn indexes_memory_usage(&self) -> u64
Returns total memory usage used by indexes.
Sourcepub fn analyze(&self) -> Result<MobileCollectionStats, VelesError>
pub fn analyze(&self) -> Result<MobileCollectionStats, VelesError>
Runs ANALYZE and returns fresh statistics for this collection.
Sourcepub fn get_stats(&self) -> MobileCollectionStats
pub fn get_stats(&self) -> MobileCollectionStats
Returns the latest known collection statistics snapshot.
Sourcepub fn sparse_search(
&self,
sparse_vector: VelesSparseVector,
limit: u32,
index_name: Option<String>,
) -> Result<Vec<SearchResult>, VelesError>
pub fn sparse_search( &self, sparse_vector: VelesSparseVector, limit: u32, index_name: Option<String>, ) -> Result<Vec<SearchResult>, VelesError>
Sourcepub fn hybrid_sparse_search(
&self,
vector: Vec<f32>,
sparse_vector: VelesSparseVector,
limit: u32,
index_name: Option<String>,
) -> Result<Vec<SearchResult>, VelesError>
pub fn hybrid_sparse_search( &self, vector: Vec<f32>, sparse_vector: VelesSparseVector, limit: u32, index_name: Option<String>, ) -> Result<Vec<SearchResult>, VelesError>
Performs hybrid dense+sparse search with RRF fusion.
Combines vector similarity search with sparse (keyword) search using Reciprocal Rank Fusion.
§Arguments
vector- Dense query vectorsparse_vector- Sparse query vector (parallel arrays)limit- Maximum number of resultsindex_name- Name of the sparse index (empty string orNonefor default)
§Returns
Vector of fused search results.
Sourcepub fn upsert_with_sparse(
&self,
point: VelesPoint,
sparse_vector: VelesSparseVector,
) -> Result<(), VelesError>
pub fn upsert_with_sparse( &self, point: VelesPoint, sparse_vector: VelesSparseVector, ) -> Result<(), VelesError>
Inserts or updates a point with an associated sparse vector.
§Arguments
point- The point to upsert (dense vector + payload)sparse_vector- Sparse vector to associate with this point
Trait Implementations§
Source§impl<UT> LiftRef<UT> for VelesCollection
impl<UT> LiftRef<UT> for VelesCollection
type LiftType = Arc<VelesCollection>
Source§impl<UT> LowerError<UT> for VelesCollection
impl<UT> LowerError<UT> for VelesCollection
Source§fn lower_error(obj: Self) -> RustBuffer
fn lower_error(obj: Self) -> RustBuffer
Source§impl<UT> LowerReturn<UT> for VelesCollection
impl<UT> LowerReturn<UT> for VelesCollection
Source§type ReturnType = <Arc<VelesCollection> as LowerReturn<UniFfiTag>>::ReturnType
type ReturnType = <Arc<VelesCollection> as LowerReturn<UniFfiTag>>::ReturnType
Source§fn lower_return(obj: Self) -> Result<Self::ReturnType, RustCallError>
fn lower_return(obj: Self) -> Result<Self::ReturnType, RustCallError>
Source§fn handle_failed_lift(
error: LiftArgsError,
) -> Result<Self::ReturnType, RustCallError>
fn handle_failed_lift( error: LiftArgsError, ) -> Result<Self::ReturnType, RustCallError>
Source§impl<UT> TypeId<UT> for VelesCollection
impl<UT> TypeId<UT> for VelesCollection
Auto Trait Implementations§
impl Freeze for VelesCollection
impl !RefUnwindSafe for VelesCollection
impl Send for VelesCollection
impl Sync for VelesCollection
impl Unpin for VelesCollection
impl UnsafeUnpin for VelesCollection
impl !UnwindSafe for VelesCollection
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
Source§impl<T, UT> HandleAlloc<UT> for T
impl<T, UT> HandleAlloc<UT> for T
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>
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>
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> Paint for Twhere
T: ?Sized,
impl<T> Paint for Twhere
T: ?Sized,
Source§fn fg(&self, value: Color) -> Painted<&T>
fn fg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the foreground set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like red() and
green(), which have the same functionality but are
pithier.
§Example
Set foreground color to white using fg():
use yansi::{Paint, Color};
painted.fg(Color::White);Set foreground color to white using white().
use yansi::Paint;
painted.white();Source§fn bright_black(&self) -> Painted<&T>
fn bright_black(&self) -> Painted<&T>
Source§fn bright_red(&self) -> Painted<&T>
fn bright_red(&self) -> Painted<&T>
Source§fn bright_green(&self) -> Painted<&T>
fn bright_green(&self) -> Painted<&T>
Source§fn bright_yellow(&self) -> Painted<&T>
fn bright_yellow(&self) -> Painted<&T>
Source§fn bright_blue(&self) -> Painted<&T>
fn bright_blue(&self) -> Painted<&T>
Source§fn bright_magenta(&self) -> Painted<&T>
fn bright_magenta(&self) -> Painted<&T>
Source§fn bright_cyan(&self) -> Painted<&T>
fn bright_cyan(&self) -> Painted<&T>
Source§fn bright_white(&self) -> Painted<&T>
fn bright_white(&self) -> Painted<&T>
Source§fn bg(&self, value: Color) -> Painted<&T>
fn bg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the background set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like on_red() and
on_green(), which have the same functionality but
are pithier.
§Example
Set background color to red using fg():
use yansi::{Paint, Color};
painted.bg(Color::Red);Set background color to red using on_red().
use yansi::Paint;
painted.on_red();Source§fn on_primary(&self) -> Painted<&T>
fn on_primary(&self) -> Painted<&T>
Source§fn on_magenta(&self) -> Painted<&T>
fn on_magenta(&self) -> Painted<&T>
Source§fn on_bright_black(&self) -> Painted<&T>
fn on_bright_black(&self) -> Painted<&T>
Source§fn on_bright_red(&self) -> Painted<&T>
fn on_bright_red(&self) -> Painted<&T>
Source§fn on_bright_green(&self) -> Painted<&T>
fn on_bright_green(&self) -> Painted<&T>
Source§fn on_bright_yellow(&self) -> Painted<&T>
fn on_bright_yellow(&self) -> Painted<&T>
Source§fn on_bright_blue(&self) -> Painted<&T>
fn on_bright_blue(&self) -> Painted<&T>
Source§fn on_bright_magenta(&self) -> Painted<&T>
fn on_bright_magenta(&self) -> Painted<&T>
Source§fn on_bright_cyan(&self) -> Painted<&T>
fn on_bright_cyan(&self) -> Painted<&T>
Source§fn on_bright_white(&self) -> Painted<&T>
fn on_bright_white(&self) -> Painted<&T>
Source§fn attr(&self, value: Attribute) -> Painted<&T>
fn attr(&self, value: Attribute) -> Painted<&T>
Enables the styling Attribute value.
This method should be used rarely. Instead, prefer to use
attribute-specific builder methods like bold() and
underline(), which have the same functionality
but are pithier.
§Example
Make text bold using attr():
use yansi::{Paint, Attribute};
painted.attr(Attribute::Bold);Make text bold using using bold().
use yansi::Paint;
painted.bold();Source§fn rapid_blink(&self) -> Painted<&T>
fn rapid_blink(&self) -> Painted<&T>
Source§fn quirk(&self, value: Quirk) -> Painted<&T>
fn quirk(&self, value: Quirk) -> Painted<&T>
Enables the yansi Quirk value.
This method should be used rarely. Instead, prefer to use quirk-specific
builder methods like mask() and
wrap(), which have the same functionality but are
pithier.
§Example
Enable wrapping using .quirk():
use yansi::{Paint, Quirk};
painted.quirk(Quirk::Wrap);Enable wrapping using wrap().
use yansi::Paint;
painted.wrap();Source§fn clear(&self) -> Painted<&T>
👎Deprecated since 1.0.1: renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
fn clear(&self) -> Painted<&T>
resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.Source§fn whenever(&self, value: Condition) -> Painted<&T>
fn whenever(&self, value: Condition) -> Painted<&T>
Conditionally enable styling based on whether the Condition value
applies. Replaces any previous condition.
See the crate level docs for more details.
§Example
Enable styling painted only when both stdout and stderr are TTYs:
use yansi::{Paint, Condition};
painted.red().on_yellow().whenever(Condition::STDOUTERR_ARE_TTY);