#search-index #index #indexing #search #generate #elasticlunr #lunr

elasticlunr-rs

A partial port of elasticlunr.js to Rust for generating static document search indexes

25 stable releases (3 major)

3.0.2 Mar 17, 2023
3.0.1 Jul 24, 2022
3.0.0 Jun 2, 2022
2.3.14 Nov 16, 2021
0.2.1 Nov 21, 2017

#62 in Database interfaces

Download history 15691/week @ 2023-12-06 14961/week @ 2023-12-13 14055/week @ 2023-12-20 13728/week @ 2023-12-27 16005/week @ 2024-01-03 16915/week @ 2024-01-10 17071/week @ 2024-01-17 16399/week @ 2024-01-24 16435/week @ 2024-01-31 19174/week @ 2024-02-07 19053/week @ 2024-02-14 17120/week @ 2024-02-21 18039/week @ 2024-02-28 21580/week @ 2024-03-06 20404/week @ 2024-03-13 17643/week @ 2024-03-20

80,611 downloads per month
Used in 12 crates (9 directly)

MIT/Apache

145KB
6K SLoC

elasticlunr-rs

Build Status Documentation Crates.io Maintenance MSRV

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

This library is passively maintained to support existing users. New users are encouraged to use a different library such as stork.

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 documents...
let mut file = File::create("out.json").unwrap();
file.write_all(index.to_json_pretty().as_bytes());

Minimum Supported Rust Version

1.60.0

Changing the minimum supported Rust version is not considered a breaking change for semver purposes.

The supported version is constrained by the version supported by our transitive dependencies. Earlier rustc versions may work if you have older versions of these in your Cargo.lock, but this is not tested.

Languages

This library includes optional support for non-English languages, see the features in Cargo.toml. Like in the JavaScript version, the language support is designed to be compatible with the lunr-languages plugins. Some languages use a modified version, which is included in the js directory of the repository.

License

This repository is offered under the terms of the

at your option.

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Includes code ported from elasticlunr.js Copyright (C) 2017 by Wei Song, used under license. See LICENSE-JS for details.

Includes stop word lists ported from stopwords-filter Copyright (C) 2012 David J. Brenes, used under license. See LICENSE-WORDS for details.

Bundled javascript code in the repository (not included in the cargo package) may have other licenses.

Dependencies

~2.9–7.5MB
~109K SLoC