pub struct Tree {
pub index: String,
pub k: usize,
pub depth: usize,
}Expand description
RAPTOR tree retrieval operator.
Searches the communities vector index, then descends the community→members
hierarchy to collect leaf-chunk IDs that hydrate() can resolve into Hits.
Construction is fluent. Pass it to crate::RetrievalBuilder::with_root or
compose with other operators via .and() / .or() / .fuse_rrf().
use lunaris_core::LunarisError;
use lunaris_retrieve::{Query, RetrievalBuilder};
use lunaris_retrieve::operators::tree::Tree;
let hits = builder
.with_root(Tree::new("communities", 5))
.execute(Query::text("What are the main themes across both reports?"))
.await?;Fields§
§index: StringVector index to search for community summaries. Typically "communities".
k: usizeNumber of top community nodes to retrieve from the vector index.
depth: usizeBFS descent depth: 1 = direct members only, 2 = members + their members, etc.
Implementations§
Source§impl Tree
impl Tree
Sourcepub fn new(index: impl Into<String>, k: usize) -> Tree
pub fn new(index: impl Into<String>, k: usize) -> Tree
Build a Tree operator targeting the given community index with k
top-level nodes and the default descent depth of DEFAULT_TREE_DEPTH.
k is clamped to super::MAX_K.
Sourcepub fn with_depth(self, depth: usize) -> Tree
pub fn with_depth(self, depth: usize) -> Tree
Override the BFS descent depth (clamped to MAX_TREE_DEPTH).
depth = 1 (default): collect direct Community.members as leaf chunks.
depth = 2: also expand sub-community members one additional level, etc.
Sourcepub fn and<R>(self, other: R) -> AndRetrieverwhere
R: Retriever + 'static,
pub fn and<R>(self, other: R) -> AndRetrieverwhere
R: Retriever + 'static,
Convenience: wrap into the standard combinator builder.
pub fn or<R>(self, other: R) -> OrRetrieverwhere
R: Retriever + 'static,
pub fn then<R>(self, other: R) -> ThenRetrieverwhere
R: Retriever + 'static,
Sourcepub fn top(self, n: usize) -> TopRetriever
pub fn top(self, n: usize) -> TopRetriever
Cap the final result set after the operator tree resolves.
Trait Implementations§
Source§impl Retriever for Tree
impl Retriever for Tree
Source§fn retrieve<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: &'life1 QueryContext,
) -> Pin<Box<dyn Future<Output = Result<Vec<RawHit>, LunarisError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Tree: 'async_trait,
fn retrieve<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: &'life1 QueryContext,
) -> Pin<Box<dyn Future<Output = Result<Vec<RawHit>, LunarisError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Tree: 'async_trait,
ctx and return the unranked-or-ranked
raw hits this operator produces. The downstream stage (combinator
or fuse_rrf) decides what to do with them.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&dyn Any so the RRF routing dispatcher can
recover the concrete operator type. Concrete operators override with
fn as_any(&self) -> &dyn Any { self }. The default returns a sentinel
&() so unknown operators downcast as None (and the dispatcher falls
back to client-side RRF instead of misrouting).Auto Trait Implementations§
impl Freeze for Tree
impl RefUnwindSafe for Tree
impl Send for Tree
impl Sync for Tree
impl Unpin for Tree
impl UnsafeUnpin for Tree
impl UnwindSafe for Tree
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> ⓘ
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