pub struct SearchIndex { /* private fields */ }Expand description
An inverted index over symbol names, tokens, and documentation.
Implementations§
Source§impl SearchIndex
impl SearchIndex
pub fn new() -> Self
Sourcepub fn insert_documentation(&mut self, text: &str, id: NodeId)
pub fn insert_documentation(&mut self, text: &str, id: NodeId)
Indexes supporting text: a docstring, signature, or file path.
This text is already parsed into every CodeNode and was previously
discarded at search time, even though a function documented as
“validates the user’s login credentials” is exactly what someone
searching for “login” wants.
Sourcepub fn search(&self, query: &str) -> Vec<NodeId> ⓘ
pub fn search(&self, query: &str) -> Vec<NodeId> ⓘ
Literal substring search. Unchanged semantics from earlier versions.
Returns node IDs sorted for deterministic output.
Sourcepub fn search_ranked(&self, query: &str) -> Vec<SearchHit>
pub fn search_ranked(&self, query: &str) -> Vec<SearchHit>
Full search across names, tokens, concepts, and documentation.
Results are ordered by score, then by node index so ties are stable. Each node appears once, under its strongest match kind.
pub fn is_empty(&self) -> bool
Trait Implementations§
Source§impl Clone for SearchIndex
impl Clone for SearchIndex
Source§impl Debug for SearchIndex
impl Debug for SearchIndex
Auto Trait Implementations§
impl Freeze for SearchIndex
impl RefUnwindSafe for SearchIndex
impl Send for SearchIndex
impl Sync for SearchIndex
impl Unpin for SearchIndex
impl UnsafeUnpin for SearchIndex
impl UnwindSafe for SearchIndex
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
Mutably borrows from an owned value. Read more