pub struct Bm25Index {
pub type_marker: String,
pub version: String,
pub options: IndexOptions,
pub doc_count: usize,
pub avg_doc_length: f64,
pub docs: HashMap<String, DocInfo>,
pub terms: HashMap<String, TermInfo>,
}Expand description
BM25 index structure - fully JSON serializable
Fields§
§type_marker: StringType marker for JSON identification
version: StringVersion for future compatibility
options: IndexOptionsIndex configuration
doc_count: usizeTotal number of documents
avg_doc_length: f64Average document length (in tokens)
docs: HashMap<String, DocInfo>Document metadata: id -> DocInfo
terms: HashMap<String, TermInfo>Inverted index: term -> TermInfo
Implementations§
Source§impl Bm25Index
impl Bm25Index
Sourcepub fn new(options: IndexOptions) -> Self
pub fn new(options: IndexOptions) -> Self
Create a new empty index with the given options
Sourcepub fn build(docs: &[Value], options: IndexOptions) -> Self
pub fn build(docs: &[Value], options: IndexOptions) -> Self
Build an index from an array of documents
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 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> 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