pub struct Reader<D: Distance> { /* private fields */ }Expand description
A reader over the hannoy hnsw graph
Implementations§
Source§impl<D: Distance> Reader<D>
impl<D: Distance> Reader<D>
Sourcepub fn open(
rtxn: &RoTxn<'_>,
index: u16,
database: Database<D>,
) -> Result<Reader<D>>
pub fn open( rtxn: &RoTxn<'_>, index: u16, database: Database<D>, ) -> Result<Reader<D>>
Returns a reader over the database with the specified Distance type.
Sourcepub fn dimensions(&self) -> usize
pub fn dimensions(&self) -> usize
Returns the number of dimensions in the index.
Sourcepub fn n_entrypoints(&self) -> usize
pub fn n_entrypoints(&self) -> usize
Returns the number of entry points to the hnsw index.
Sourcepub fn item_ids(&self) -> &RoaringBitmap
pub fn item_ids(&self) -> &RoaringBitmap
Returns all the item ids contained in this index.
Sourcepub fn n_nodes(&self, rtxn: &RoTxn<'_>) -> Result<Option<NonZeroUsize>>
pub fn n_nodes(&self, rtxn: &RoTxn<'_>) -> Result<Option<NonZeroUsize>>
Returns the number of nodes in the index. Useful to run an exhaustive search.
Sourcepub fn item_vector(
&self,
rtxn: &RoTxn<'_>,
item_id: ItemId,
) -> Result<Option<Vec<f32>>>
pub fn item_vector( &self, rtxn: &RoTxn<'_>, item_id: ItemId, ) -> Result<Option<Vec<f32>>>
Returns the vector for item i that was previously added.
Sourcepub fn contains_item(&self, rtxn: &RoTxn<'_>, item_id: ItemId) -> Result<bool>
pub fn contains_item(&self, rtxn: &RoTxn<'_>, item_id: ItemId) -> Result<bool>
Returns true if the database contains the given item.
Sourcepub fn iter<'t>(&self, rtxn: &'t RoTxn<'_>) -> Result<ItemIter<'t, D>>
pub fn iter<'t>(&self, rtxn: &'t RoTxn<'_>) -> Result<ItemIter<'t, D>>
Returns an iterator over the items vector.
Sourcepub fn nns(&self, count: usize) -> QueryBuilder<'_, D>
pub fn nns(&self, count: usize) -> QueryBuilder<'_, D>
Return a QueryBuilder that lets you configure and execute a search request.
You must provide the number of items you want to receive.
Trait Implementations§
Auto Trait Implementations§
impl<D> Freeze for Reader<D>
impl<D> RefUnwindSafe for Reader<D>where
D: RefUnwindSafe,
impl<D> Send for Reader<D>
impl<D> Sync for Reader<D>
impl<D> Unpin for Reader<D>where
D: Unpin,
impl<D> UnwindSafe for Reader<D>where
D: UnwindSafe,
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§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