pub struct TwoTierIndex {
pub metadata: TwoTierMetadata,
/* private fields */
}Expand description
Two-tier index for progressive search.
Delegates vector storage and search to frankensearch’s file-backed FSVI
TwoTierIndex, with cass-specific side tables for DocumentId enum
and message_id SQLite foreign keys.
Fields§
§metadata: TwoTierMetadataIndex metadata.
Implementations§
Source§impl TwoTierIndex
impl TwoTierIndex
Sourcepub fn build(
fast_embedder_id: impl Into<String>,
quality_embedder_id: impl Into<String>,
config: &TwoTierConfig,
entries: impl IntoIterator<Item = TwoTierEntry>,
) -> Result<Self>
pub fn build( fast_embedder_id: impl Into<String>, quality_embedder_id: impl Into<String>, config: &TwoTierConfig, entries: impl IntoIterator<Item = TwoTierEntry>, ) -> Result<Self>
Build a two-tier index from entries.
Creates a temporary FSVI index via frankensearch’s TwoTierIndexBuilder,
then opens it for search. The temp directory is kept alive as long as the
index exists.
Sourcepub fn doc_id(&self, idx: usize) -> Option<&DocumentId>
pub fn doc_id(&self, idx: usize) -> Option<&DocumentId>
Get document ID at index.
Sourcepub fn message_id(&self, idx: usize) -> Option<u64>
pub fn message_id(&self, idx: usize) -> Option<u64>
Get message ID at index.
Sourcepub fn search_fast(&self, query_vec: &[f32], k: usize) -> Vec<ScoredResult>
pub fn search_fast(&self, query_vec: &[f32], k: usize) -> Vec<ScoredResult>
Search using fast embeddings only.
Delegates to frankensearch’s TwoTierIndex::search_fast().
Sourcepub fn search_quality(&self, query_vec: &[f32], k: usize) -> Vec<ScoredResult>
pub fn search_quality(&self, query_vec: &[f32], k: usize) -> Vec<ScoredResult>
Search using quality embeddings only.
Delegates to frankensearch’s quality search via search_fast on the
quality index. Since frankensearch’s TwoTierIndex stores both tiers,
we use quality_scores_for_hits with all documents as candidates.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TwoTierIndex
impl !RefUnwindSafe for TwoTierIndex
impl Send for TwoTierIndex
impl Sync for TwoTierIndex
impl Unpin for TwoTierIndex
impl UnsafeUnpin for TwoTierIndex
impl !UnwindSafe for TwoTierIndex
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync 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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, _span: NoopSpan) -> Self
fn instrument(self, _span: NoopSpan) -> Self
Source§fn in_current_span(self) -> Self
fn in_current_span(self) -> 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 more