pub struct IndexBuilder { /* private fields */ }
Expand description
A builder for an Index
with custom parameters.
§Example
let mut index = IndexBuilder::new()
.save_docs(false)
.add_fields(&["title", "subtitle", "body"])
.set_ref("doc_id")
.build();
index.add_doc("doc_a", &["Chapter 1", "Welcome to Copenhagen", "..."]);
Implementations§
Source§impl IndexBuilder
impl IndexBuilder
pub fn new() -> Self
pub fn with_language(language: Box<dyn Language>) -> Self
Sourcepub fn save_docs(self, save: bool) -> Self
pub fn save_docs(self, save: bool) -> Self
Set whether or not documents should be saved in the Index
’s document store.
Sourcepub fn add_field_with_tokenizer(
self,
field: &str,
tokenizer: Box<dyn Fn(&str) -> Vec<String>>,
) -> Self
pub fn add_field_with_tokenizer( self, field: &str, tokenizer: Box<dyn Fn(&str) -> Vec<String>>, ) -> Self
Add a document field to the Index
, with a custom tokenizer for that field.
§Panics
Panics if a field with the name already exists.
Sourcepub fn add_fields<I>(self, fields: I) -> Self
pub fn add_fields<I>(self, fields: I) -> Self
Trait Implementations§
Auto Trait Implementations§
impl Freeze for IndexBuilder
impl !RefUnwindSafe for IndexBuilder
impl !Send for IndexBuilder
impl !Sync for IndexBuilder
impl Unpin for IndexBuilder
impl !UnwindSafe for IndexBuilder
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