pub struct Index { /* private fields */ }
Expand description

An elasticlunr search index.

Implementations

Create a new index with the provided fields.

Example
let mut index = Index::new(&["title", "body"]);
index.add_doc("1", &["this is a title", "this is body text"]);
Panics

Panics if a field with the name already exists.

Create a new index with the provided fields for the given Language.

Example
use elasticlunr::{Index, lang::English};
let mut index = Index::with_language(English::new(), &["title", "body"]);
index.add_doc("1", &["this is a title", "this is body text"]);
Panics

Panics if a field with the name already exists.

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
let mut index = Index::new(&["title", "body"]);
index.add_doc("1", &["this is a title", "this is body text"]);

Returns the index, serialized to pretty-printed JSON.

Returns the index, serialized to JSON.

Trait Implementations

Deserialize this value from the given Serde deserializer. Read more

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.