Skip to main content

KnowledgeBaseIndex

Struct KnowledgeBaseIndex 

Source
pub struct KnowledgeBaseIndex {
    pub pages: HashMap<PageId, PageMeta>,
    pub sorted_ids: Vec<PageId>,
    pub index_issues: Vec<ParseIssue>,
    /* private fields */
}
Expand description

Indexed knowledge base metadata with lazy page loading.

Fields§

§pages: HashMap<PageId, PageMeta>

Metadata map keyed by canonical page id.

§sorted_ids: Vec<PageId>

Page ids in case-insensitive title sort order, computed once at open time.

§index_issues: Vec<ParseIssue>

Non-fatal issues encountered while scanning metadata.

Implementations§

Source§

impl KnowledgeBaseIndex

Source

pub fn load_page(&self, id: &str) -> Result<Page>

Loads and parses a single page by canonical id.

Returns an error if the id is missing from the index or if JSON parsing fails.

Source

pub fn sorted_pages(&self) -> Vec<&PageMeta>

Returns metadata entries in cached title-sorted order.

Source

pub fn filter_page_ids(&self, query: &str) -> Vec<PageId>

Returns page ids filtered by metadata query (title/id/tags), sorted by title.

Source

pub fn search_hits(&self, query: &str, include_content: bool) -> Vec<SearchHit>

Searches pages by metadata and optionally content, returning sorted hits.

Source

pub fn resolve_page_id_by_title(&self, title: &str) -> TitleResolution

Resolves a page id from title using case-insensitive exact match, then partial match.

Classifies a raw link target for navigation/open behavior.

Source

pub fn root(&self) -> &Path

Returns the root path used to build this index.

Source

pub fn attachment_resolver(&self) -> AttachmentResolver

Returns an attachment resolver rooted at this knowledge base.

Trait Implementations§

Source§

impl Clone for KnowledgeBaseIndex

Source§

fn clone(&self) -> KnowledgeBaseIndex

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for KnowledgeBaseIndex

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.