pub struct BrainIndex { /* private fields */ }Implementations§
Source§impl BrainIndex
impl BrainIndex
pub fn open(brain_path: impl AsRef<Path>) -> Result<Self>
Sourcepub fn rebuild(&self, embedder: Option<&dyn Embedder>) -> Result<RebuildStats>
pub fn rebuild(&self, embedder: Option<&dyn Embedder>) -> Result<RebuildStats>
Walk the brain directory, parse markdown files, and repopulate the
index, then embed any new or changed entries (skipped entirely if
embedder is None, or if embedding a given entry fails — indexing
is never blocked by the embedding step).
Sourcepub fn query(
&self,
text: &str,
embedder: Option<&dyn Embedder>,
filters: QueryFilters,
) -> Result<Vec<BrainEntry>>
pub fn query( &self, text: &str, embedder: Option<&dyn Embedder>, filters: QueryFilters, ) -> Result<Vec<BrainEntry>>
Hybrid full-text + semantic search. When text is non-empty and
embedder is Some, blends the existing FTS5 keyword ranking with
vector similarity via Reciprocal Rank Fusion. Falls back to exactly
today’s keyword-only (or filter-only) behavior when text is empty
or embedder is None.
Sourcepub fn get(&self, id: &str) -> Result<Option<BrainEntry>>
pub fn get(&self, id: &str) -> Result<Option<BrainEntry>>
Fetch a single entry by its relative path id.
Sourcepub fn backlinks(&self, id: &str) -> Result<Vec<BrainEntry>>
pub fn backlinks(&self, id: &str) -> Result<Vec<BrainEntry>>
Entries whose links resolve to id (i.e. entries that link to id).
Resolution rule (matches the app’s render-time wikilink resolution):
a raw link target t resolves to entry e when
t == e.name OR t == e.id OR stem(t) == stem(e.id) OR stem(t) == e.name.
Sourcepub fn outlinks(&self, id: &str) -> Result<Vec<BrainEntry>>
pub fn outlinks(&self, id: &str) -> Result<Vec<BrainEntry>>
Resolved targets of id’s own links (i.e. entries that id links to).
Sourcepub fn links_all(&self) -> Result<Vec<(String, String)>>
pub fn links_all(&self) -> Result<Vec<(String, String)>>
The full resolved (from_id, to_id) edge list, for pinboard rendering.
Entries related to id, ranked: direct links (either direction) first,
then co-citation (entries reachable via a shared linked target or a
shared linking source), then entries sharing at least one tag.
Deduplicated, excludes id itself, capped at limit.
Auto Trait Implementations§
impl !Freeze for BrainIndex
impl RefUnwindSafe for BrainIndex
impl Send for BrainIndex
impl Sync for BrainIndex
impl Unpin for BrainIndex
impl UnsafeUnpin for BrainIndex
impl UnwindSafe for BrainIndex
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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> 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> 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