pub struct IndexSet { /* private fields */ }Implementations§
Source§impl IndexSet
impl IndexSet
pub fn new( build_params: impl Fn() -> Result<HnswParams, CoreError>, ) -> Result<Self, CoreError>
pub fn insert_atomic( &mut self, id: u64, memory_id: &str, embedding: &ThreeFieldEmbedding, rng_value: f64, ) -> Result<(), CoreError>
pub fn resolve_node_id(&self, node_id: u64) -> Option<&str>
pub fn rebuild_id_map(&mut self, entries: impl Iterator<Item = (u64, String)>)
pub fn search( &self, query: &[f32], top_k: usize, ) -> Result<Vec<(u64, f32)>, HnswError>
Sourcepub fn find_duplicate(
&self,
embedding: &ThreeFieldEmbedding,
threshold: f32,
) -> Result<Option<(u64, f32)>, HnswError>
pub fn find_duplicate( &self, embedding: &ThreeFieldEmbedding, threshold: f32, ) -> Result<Option<(u64, f32)>, HnswError>
Find the best existing near-duplicate of embedding under the ALL-THREE policy:
a candidate qualifies only when its context, action AND result similarities each
exceed threshold. Returns the qualifying node with the highest minimum-field
similarity, or None. Uses only per-graph HNSW search (top_k=K) intersected across
the three fields — with top_k=1 the three graphs return different top nodes and the
all-three condition would almost never hold.
pub fn delete(&mut self, id: u64) -> Result<(), HnswError>
pub fn contains(&self, id: u64) -> bool
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn serialize<W: Write>(&self, writer: &mut W) -> Result<()>
pub fn deserialize<R: Read>(reader: &mut R) -> Result<Self, HnswError>
Auto Trait Implementations§
impl Freeze for IndexSet
impl RefUnwindSafe for IndexSet
impl Send for IndexSet
impl Sync for IndexSet
impl Unpin for IndexSet
impl UnsafeUnpin for IndexSet
impl UnwindSafe for IndexSet
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 more