pub struct BM25Index {
pub chunks: Vec<CodeChunk>,
pub inverted: HashMap<String, Vec<(usize, f64)>>,
pub avg_doc_len: f64,
pub doc_count: usize,
pub doc_freqs: HashMap<String, usize>,
}Fields§
§chunks: Vec<CodeChunk>§inverted: HashMap<String, Vec<(usize, f64)>>§avg_doc_len: f64§doc_count: usize§doc_freqs: HashMap<String, usize>Implementations§
Source§impl BM25Index
impl BM25Index
pub fn new() -> Self
pub fn build_from_directory(root: &Path) -> Self
pub fn search(&self, query: &str, top_k: usize) -> Vec<SearchResult>
pub fn save(&self, root: &Path) -> Result<()>
pub fn load(root: &Path) -> Option<Self>
pub fn load_or_build(root: &Path) -> Self
pub fn index_file_path(root: &Path) -> PathBuf
Trait Implementations§
Source§impl<'de> Deserialize<'de> for BM25Index
impl<'de> Deserialize<'de> for BM25Index
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for BM25Index
impl RefUnwindSafe for BM25Index
impl Send for BM25Index
impl Sync for BM25Index
impl Unpin for BM25Index
impl UnsafeUnpin for BM25Index
impl UnwindSafe for BM25Index
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
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>
Converts
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>
Converts
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