]>
Commit | Line | Data |
---|---|---|
72b1a166 FG |
1 | extern crate elasticlunr; |
2 | ||
3 | use elasticlunr::Index; | |
4 | use std::fs::File; | |
5 | use std::io::Write; | |
6 | ||
7 | fn main() { | |
8 | let mut index = Index::new(&["title", "body"]); | |
9 | index.add_doc( | |
10 | "1", | |
11 | &[ | |
12 | "This Week in Rust 207", | |
13 | "Hello and welcome to another issue of This Week in Rust!", | |
14 | ], | |
15 | ); | |
16 | index.add_doc( | |
17 | "2", | |
18 | &[ | |
19 | "This Week in Rust 206", | |
20 | "Hello and welcome to another issue of This Week in Rust!", | |
21 | ], | |
22 | ); | |
23 | let mut file = File::create("examples/out.json").unwrap(); | |
24 | file.write_all(index.to_json_pretty().as_bytes()).unwrap(); | |
25 | } |