Struct elasticlunr::Index

source ·
pub struct Index {
    pub fields: Vec<String>,
    pub pipeline: Pipeline,
    pub ref_field: String,
    pub version: &'static str,
    pub document_store: DocumentStore,
    /* private fields */
}
Expand description

An elasticlunr search index.

Fields§

§fields: Vec<String>§pipeline: Pipeline§ref_field: String§version: &'static str§document_store: DocumentStore

Implementations§

Create a new index with the provided fields.

Example
let mut index = Index::new(&["title", "body", "breadcrumbs"]);
index.add_doc("1", &["How to Foo", "First, you need to `bar`.", "Chapter 1 > How to Foo"]);
Panics

Panics if multiple given fields are identical.

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

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

Panics if multiple given fields are identical.

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§

Formats the value using the given formatter. Read more
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.