Struct elasticlunr::IndexBuilder [−][src]
pub struct IndexBuilder { /* fields omitted */ }
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", "..."]);
Methods
impl IndexBuilder
[src]
impl IndexBuilder
pub fn new() -> Self
[src]
pub fn new() -> Self
pub fn save_docs(self, save: bool) -> Self
[src]
pub fn save_docs(self, save: bool) -> Self
Set whether or not documents should be saved in the Index
's document store.
pub fn add_field(self, field: &str) -> Self
[src]
pub fn add_field(self, field: &str) -> Self
Add a document field to the Index
.
If the Index
already contains a field with an identical name, adding it again is a no-op.
pub fn add_fields<I>(self, fields: I) -> Self where
I: IntoIterator,
I::Item: AsRef<str>,
[src]
pub fn add_fields<I>(self, fields: I) -> Self where
I: IntoIterator,
I::Item: AsRef<str>,
Add the document fields to the Index
.
If the Index
already contains a field with an identical name, adding it again is a no-op.
pub fn set_ref(self, ref_field: &str) -> Self
[src]
pub fn set_ref(self, ref_field: &str) -> Self
Set the key used to store the document reference field.
pub fn set_pipeline(self, pipeline: Pipeline) -> Self
[src]
pub fn set_pipeline(self, pipeline: Pipeline) -> Self
Set the pipeline used by the Index
.
pub fn build(self) -> Index
[src]
pub fn build(self) -> Index
Build an Index
from this builder.
Trait Implementations
impl Default for IndexBuilder
[src]
impl Default for IndexBuilder
Auto Trait Implementations
impl Send for IndexBuilder
impl Send for IndexBuilder
impl Sync for IndexBuilder
impl Sync for IndexBuilder