diff options
author | Baitinq <manuelpalenzuelamerino@gmail.com> | 2022-10-28 18:45:30 +0200 |
---|---|---|
committer | Baitinq <manuelpalenzuelamerino@gmail.com> | 2022-10-28 18:45:30 +0200 |
commit | 59dd5753849995f9e8dfaf6ad6f3cfcbd5d5a829 (patch) | |
tree | e6289841715543f0890b14fe3b9863246740088e /indexer | |
parent | Frontend: Improve responsive layout (diff) | |
download | OSSE-59dd5753849995f9e8dfaf6ad6f3cfcbd5d5a829.tar.gz OSSE-59dd5753849995f9e8dfaf6ad6f3cfcbd5d5a829.tar.bz2 OSSE-59dd5753849995f9e8dfaf6ad6f3cfcbd5d5a829.zip |
Frontend: Refactor search_word_in_db() to not need explicit lifetimes
Diffstat (limited to 'indexer')
-rw-r--r-- | indexer/src/main.rs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/indexer/src/main.rs b/indexer/src/main.rs index 8f12528..e63533b 100644 --- a/indexer/src/main.rs +++ b/indexer/src/main.rs @@ -110,7 +110,7 @@ async fn search(data: web::Data<AppState>, term: web::Path<String>) -> impl Resp //percentage of valid words let mut valid_results: Option<HashSet<CrawledResource>> = None; for w in query { - let curr_word_results = match search_word_in_db(&database, w) { + let curr_word_results = match search_word_in_db(&database, w.to_string()) { None => return "[]".to_string(), Some(curr_results) => curr_results, }; @@ -133,11 +133,11 @@ async fn search(data: web::Data<AppState>, term: web::Path<String>) -> impl Resp serde_json::to_string(&valid_results.unwrap()).unwrap() } -fn search_word_in_db<'a>( - db: &'a HashMap<String, HashSet<CrawledResource>>, - word: &'a str, -) -> Option<&'a HashSet<CrawledResource>> { - db.get(word) +fn search_word_in_db( + db: &HashMap<String, HashSet<CrawledResource>>, + word: String, +) -> Option<&HashSet<CrawledResource>> { + db.get(&word) } //TODO! |