pub fn search_layer<'a>(
        &self,
        q: &T,
        ef: usize,
        level: usize,
        searcher: &mut Searcher<Met::Unit>,
        dest: &'a mut [Neighbor<Met::Unit>],
    ) -> &'a mut [Neighbor<Met::Unit>] {
        // If there is nothing in here, then just return nothing.
        if self.features.is_empty() || level >= self.layers() {
            return &mut [];
        }

        self.initialize_searcher(q, searcher);
        let cap = 1;

        for (ix, layer) in self.layers.iter().enumerate().rev() {
            self.search_single_layer(q, searcher, layer, cap);
            if ix + 1 == level {
                let found = core::cmp::min(dest.len(), searcher.nearest.len());
                dest.copy_from_slice(&searcher.nearest[..found]);
                return &mut dest[..found];
            }
            self.lower_search(layer, searcher);
        }

        let cap = ef;

        self.search_zero_layer(q, searcher, cap);

        let found = core::cmp::min(dest.len(), searcher.nearest.len());
        dest.copy_from_slice(&searcher.nearest[..found]);
        &mut dest[..found]
    }
/// Performs the same algorithm as [`HNSW::nearest`], but stops on a particular layer of the network
/// and returns the unique index on that layer rather than the item index.
///
/// If this is passed a `level` of `0`, then this has the exact same functionality as [`HNSW::nearest`]
/// since the unique indices at layer `0` are the item indices.
Performs the same algorithm as [`HNSW::nearest`], but stops on a particular layer of the network
and returns the unique index on that layer rather than the item index.


Performs the same algorithm as [ ` HNSW :: nearest ` ] but stops on a particular layer of the network and returns the unique index on that layer rather than the item index .
pub fn search_layer<'a>(
        &self,
        q: &T,
        ef: usize,
        level: usize,
        searcher: &mut Searcher<Met::Unit>,
        dest: &'a mut [Neighbor<Met::Unit>],
    ) -> &'a mut [Neighbor<Met::Unit>] {
        // If there is nothing in here, then just return nothing.
        if self.features.is_empty() || level >= self.layers() {
            return &mut [];
        }
        self.initialize_searcher(q, searcher);
        let cap = 1;
        for (ix, layer) in self.layers.iter().enumerate().rev() {
            self.search_single_layer(q, searcher, layer, cap);
            if ix + 1 == level {
                let found = core::cmp::min(dest.len(), searcher.nearest.len());
                dest.copy_from_slice(&searcher.nearest[..found]);
                return &mut dest[..found];
            }
            self.lower_search(layer, searcher);
        }
        let cap = ef;
        self.search_zero_layer(q, searcher, cap);
        let found = core::cmp::min(dest.len(), searcher.nearest.len());
        dest.copy_from_slice(&searcher.nearest[..found]);
        &mut dest[..found]
    }
pub fn search_layer < ' a > ( & self , q : & T , ef : usize , level : usize , searcher : & mut Searcher < Met :: Unit > , dest : & ' a mut [ Neighbor < Met :: Unit > ] , ) -> & ' a mut [ Neighbor < Met :: Unit > ] { // If there is nothing in here, then just return nothing. if self . features . is_empty ( ) || level >= self . layers ( ) { return & mut [ ] ; } self . initialize_searcher ( q , searcher ) ; let cap = 1 ; for ( ix , layer ) in self . layers . iter ( ) . enumerate ( ) . rev ( ) { self . search_single_layer ( q , searcher , layer , cap ) ; if ix + 1 == level { let found = core :: cmp :: min ( dest . len ( ) , searcher . nearest . len ( ) ) ; dest . copy_from_slice ( & searcher . nearest [ .. found ] ) ; return & mut dest [ .. found ] ; } self . lower_search ( layer , searcher ) ; } let cap = ef ; self . search_zero_layer ( q , searcher , cap ) ; let found = core :: cmp :: min ( dest . len ( ) , searcher . nearest . len ( ) ) ; dest . copy_from_slice ( & searcher . nearest [ .. found ] ) ; & mut dest [ .. found ] }
Performs the same algorithm as [`HNSW::nearest`], but stops on a particular layer of the network
and returns the unique index on that layer rather than the item index.
Performs the same algorithm as [ ` HNSW :: nearest ` ] but stops on a particular layer of the network and returns the unique index on that layer rather than the item index .
&self
q
&T
ef
usize
level
usize
searcher
&mut Searcher<Met::Unit>
dest
&'a mut [Neighbor<Met::Unit>]
&self
q
&T
ef
usize
level
usize
searcher
&mut Searcher<Met::Unit>
dest
&'a mut [Neighbor<Met::Unit>]