pub struct VelesCollection { /* private fields */ }Expand description
A collection of vectors with associated metadata.
inner is a detached core collection leaf with no observer reference, so
every governed read is routed back through the owning database’s
control-plane gate (db.gated_search / db.authorize_read) rather than
hitting the leaf directly — restoring observer governance for the mobile
direct-search API (audit F-5.4, #1392). Reads with no observer registered
take a single Option check and then the same leaf call as before
(zero-overhead contract).
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 search_with_quality(
&self,
vector: Vec<f32>,
limit: u32,
quality: SearchQuality,
) -> Result<Vec<SearchResult>, VelesError>
pub fn search_with_quality( &self, vector: Vec<f32>, limit: u32, quality: SearchQuality, ) -> 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,
) -> Result<Vec<SearchResult>, VelesError>
pub fn text_search( &self, query: String, limit: u32, ) -> Result<Vec<SearchResult>, VelesError>
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 enable_streaming(
&self,
config: Option<MobileStreamingConfig>,
) -> Result<(), VelesError>
pub fn enable_streaming( &self, config: Option<MobileStreamingConfig>, ) -> Result<(), VelesError>
Enables streaming ingestion on this collection.
Must be called before stream_insert; otherwise
stream inserts fail with “not configured”. Calling it again replaces the
existing ingester.
§Arguments
config- OptionalMobileStreamingConfig.Noneuses the engine defaults (buffer_size=10000,batch_size=128,flush_interval_ms=50).
Sourcepub fn stream_insert(&self, points: Vec<VelesPoint>) -> Result<u64, VelesError>
pub fn stream_insert(&self, points: Vec<VelesPoint>) -> Result<u64, VelesError>
Queues a batch of points for streaming ingestion.
Requires enable_streaming to have been called
first. Returns the number of points successfully queued.
§Arguments
points- Points to queue for ingestion
Sourcepub fn flush(&self) -> Result<(), VelesError>
pub fn flush(&self) -> Result<(), VelesError>
Flushes collection data to durable storage.
Sourcepub fn compact_storage(&self) -> Result<u64, VelesError>
pub fn compact_storage(&self) -> Result<u64, VelesError>
Compacts on-disk storage, reclaiming space left by deleted vectors.
Returns the number of bytes reclaimed.
Sourcepub fn guard_rails(&self) -> MobileQueryLimits
pub fn guard_rails(&self) -> MobileQueryLimits
Returns the current query guardrail limits for this collection.
Sourcepub fn apply_advanced_config(
&self,
config: MobileAdvancedConfig,
) -> Result<(), VelesError>
pub fn apply_advanced_config( &self, config: MobileAdvancedConfig, ) -> Result<(), VelesError>
Applies post-creation overrides to advanced configuration fields
(pq_rescore_oversampling, deferred_indexing,
async_index_builder) and persists the updated config. Each Some
field is applied; each None field is left unchanged.
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 diagnostics(&self) -> MobileCollectionDiagnostics
pub fn diagnostics(&self) -> MobileCollectionDiagnostics
Returns a health/readiness diagnostics snapshot for this collection.
Source§impl VelesCollection
impl VelesCollection
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 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.
Sourcepub fn multi_query_search_ids(
&self,
vectors: Vec<Vec<f32>>,
limit: u32,
strategy: FusionStrategy,
) -> Result<Vec<SearchResult>, VelesError>
pub fn multi_query_search_ids( &self, vectors: Vec<Vec<f32>>, limit: u32, strategy: FusionStrategy, ) -> Result<Vec<SearchResult>, VelesError>
Performs multi-query search returning IDs and scores only.
Id-only twin of Self::multi_query_search: reuses the same fusion
path but strips payloads, avoiding payload materialization.
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.
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 !RefUnwindSafe for VelesCollection
impl !UnwindSafe for VelesCollection
impl Freeze for VelesCollection
impl Send for VelesCollection
impl Sync for VelesCollection
impl Unpin for VelesCollection
impl UnsafeUnpin 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>
renamed to 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);