]>
Commit | Line | Data |
---|---|---|
3dfed10e XL |
1 | # elasticlunr-rs |
2 | ||
3 | ![Build Status](https://github.com/mattico/elasticlunr-rs/workflows/CI/badge.svg) | |
4 | [![Documentation](https://docs.rs/elasticlunr-rs/badge.svg)](https://docs.rs/elasticlunr-rs) | |
5 | [![Crates.io](https://img.shields.io/crates/v/elasticlunr-rs.svg)](https://crates.io/crates/elasticlunr-rs) | |
064997fb | 6 | ![Maintenance](https://img.shields.io/badge/Maintenance-Passive-yellow) |
3dfed10e XL |
7 | |
8 | A partial port of [elasticlunr.js][eljs] to Rust. Intended to be used for | |
9 | generating compatible search indices. | |
10 | ||
11 | ## Example | |
12 | ||
13 | ```Rust | |
14 | use std::fs::File; | |
15 | use std::io::Write; | |
16 | use elasticlunr::Index; | |
17 | ||
18 | let mut index = Index::new(&["title", "body"]); | |
19 | index.add_doc("1", &["This is a title", "This is body text!"]); | |
20 | // Add more documents... | |
21 | let mut file = File::create("out.json").unwrap(); | |
22 | file.write_all(index.to_json_pretty().as_bytes()); | |
23 | ``` | |
24 | ||
064997fb FG |
25 | ## Minimum Supported Rust Version |
26 | ||
27 | 1.54.0 | |
28 | ||
29 | ## Languages | |
30 | ||
31 | This library includes optional support for non-English languages, see the features in `Cargo.toml`. Like in the JavaScript | |
32 | version, the language support is designed to be compatible with the [lunr-languages plugins][lunr-languages]. Some | |
33 | languages use a modified version, which is included in the `js` directory of the repository. | |
34 | ||
3dfed10e XL |
35 | ## License |
36 | ||
37 | This repository is offered under the terms of the | |
38 | ||
39 | - Apache License, Version 2.0, (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0) | |
40 | - MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT) | |
41 | ||
42 | at your option. | |
43 | ||
44 | Unless you explicitly state otherwise, any contribution intentionally submitted | |
45 | for inclusion in the work by you, as defined in the Apache-2.0 license, shall be | |
46 | dual licensed as above, without any additional terms or conditions. | |
47 | ||
48 | Includes code ported from [elasticlunr.js][eljs] Copyright (C) 2017 by Wei Song, | |
49 | used under license. See LICENSE-JS for details. | |
50 | ||
51 | Includes stop word lists ported from [stopwords-filter][swft] Copyright (C) 2012 | |
52 | David J. Brenes, used under license. See LICENSE-WORDS for details. | |
53 | ||
064997fb FG |
54 | Bundled javascript code in the repository (not included in the cargo package) may have other licenses. |
55 | ||
56 | [lunr-languages]: https://github.com/MihaiValentin/lunr-languages | |
3dfed10e | 57 | [eljs]: https://github.com/weixsong/elasticlunr.js |
064997fb | 58 | [swft]: https://github.com/brenes/stopwords-filter |