Crate elasticlunr[][src]

elasticlunr-rs

Build Status Documentation Crates.io

A partial port of elasticlunr to Rust. Intended to be used for generating compatible search indices.

Access to all index-generating functionality is provided. Most users will only need to use the Index or IndexBuilder types.

Example

use std::fs::File;
use std::io::Write;
use elasticlunr::Index;

let mut index = Index::new(&["title", "body"]);
index.add_doc("1", &["This is a title", "This is body text!"]);
// Add more docs...
let mut file = File::create("out.json").unwrap();
file.write_all(index.to_json_pretty().as_bytes());

Re-exports

pub use lang::Language;
pub use pipeline::Pipeline;

Modules

config

These types are not used for generating Indexes. They are provided to help with creating compatible JSON structures for configuring the JavaScript search function.

document_store

Implements an elasticlunr.js document store. Most users do not need to use this module directly.

inverted_index

Implements an elasticlunr.js inverted index. Most users do not need to use this module directly.

lang

Intended to be compatible with https://github.com/MihaiValentin/lunr-languages. Each supported language has a trimmer, a stop word filter, and a stemmer. Most users will not need to use these modules directly.

pipeline

Defines the pipeline which processes text for inclusion in the index. Most users do not need to use this module directly.

Structs

Index

An elasticlunr search index.

IndexBuilder

A builder for an Index with custom parameters.

Constants

ELASTICLUNR_VERSION

The version of elasticlunr.js this library was designed for.