about summary refs log tree commit diff
path: root/indexer
diff options
context:
space:
mode:
authorBaitinq <manuelpalenzuelamerino@gmail.com>2022-10-28 18:45:30 +0200
committerBaitinq <manuelpalenzuelamerino@gmail.com>2022-10-28 18:45:30 +0200
commit59dd5753849995f9e8dfaf6ad6f3cfcbd5d5a829 (patch)
treee6289841715543f0890b14fe3b9863246740088e /indexer
parentFrontend: Improve responsive layout (diff)
downloadOSSE-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.rs12
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!