Struct elasticlunr::Index
[−]
[src]
pub struct Index { /* fields omitted */ }
An elasticlunr search index.
Methods
impl Index
[src]
fn new<S, I: IntoIterator<Item = S>>(fields: I) -> Self where
S: AsRef<str>,
[src]
S: AsRef<str>,
Create a new index with the provided fields.
fn add_doc<S, I: IntoIterator<Item = S>>(&mut self, doc_ref: &str, data: I) where
S: AsRef<str>,
[src]
S: AsRef<str>,
Add the data from a document to the index.
NOTE: The elements of data
should be provided in the same order as
the fields used to create the index.
Example
use elasticlunr::Index; let mut index = Index::new(&["title", "body"]); index.add_doc("1", &["this is a title", "this is body text"]);
fn get_fields(&self) -> &[String]
[src]
fn to_json_pretty(&self) -> String
[src]
Returns the index, serialized to pretty-printed JSON.
fn to_json(&self) -> String
[src]
Returns the index, serialized to JSON.