Skip to main content

HybridStore

Struct HybridStore 

Source
pub struct HybridStore { /* private fields */ }
Expand description

Executes hybrid graph + vector queries.

Implementations§

Source§

impl HybridStore

Source

pub fn query( &self, q: HybridQuery<'_>, col: &Collection, ) -> Result<Vec<HybridResult>>

Run a hybrid graph + vector query.

The algorithm proceeds in three stages:

  1. Graph traversal — walks the memory graph from q.anchor_node up to q.graph_depth hops, recording the maximum edge weight seen for each reachable node.
  2. Vector search — retrieves the top q.top_k × 20 approximate nearest neighbours from the named collection.
  3. Score blending — for each candidate, computes rank = q.alpha × vec_similarity + (1 − q.alpha) × graph_weight, then returns the top q.top_k results sorted by rank descending.
Source

pub fn tri_modal_query( &self, q: &TriModalQuery, col: &Collection, ) -> Result<Vec<TriModalResult>>

Run a tri-modal graph + vector + FTS query.

The algorithm runs three searches and blends results:

  1. Vector ANN — retrieves top_k × 20 approximate nearest neighbours.
  2. Graph traversal — walks the memory graph from q.anchor_node up to q.graph_depth hops, recording the maximum edge weight per reachable node.
  3. FTS keyword search — BM25 full-text search over the collection’s FTS index.

Each component is min-max normalised to [0, 1] within its own result set, then blended as final_score = alpha × vec_score + beta × graph_weight + gamma × fts_score.

The weights must satisfy alpha + beta + gamma ≈ 1.0 (tolerance ±0.01).

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.