1use std::{collections::HashMap, fs, path::Path};
2
3use book::Book;
4use text_search::Indexer;
5
6mod book;
7
8fn main() {
9 let path = "/home/salman/text-search-test";
10 let _ = fs::remove_dir_all(&path);
11 let _ = fs::create_dir(&path);
12 let mut indexer = Indexer::<Book>::new(Path::new(path));
13 let books = Book::get_sample_books();
14 for book in &books {
15 indexer.index(book.clone());
16 }
17 indexer.commit();
18
19 let filter = HashMap::from([("tags", "xyz")]);
20 let regex_search_result = indexer.hybrid_search(filter, "name", "Rust", 10);
21 for book in regex_search_result {
22 println!("{:?}", book);
23 }
24}