diff options
author | Baitinq <manuelpalenzuelamerino@gmail.com> | 2022-11-05 17:40:52 +0100 |
---|---|---|
committer | Baitinq <manuelpalenzuelamerino@gmail.com> | 2022-11-05 17:40:52 +0100 |
commit | 5dc49ccef08a86430a597ec63cf79f8322dab6d1 (patch) | |
tree | 51de5c3f57f1b673900863b2cbd93316fd93c97c | |
parent | Frontend: Display number of results below search bar (diff) | |
download | OSSE-5dc49ccef08a86430a597ec63cf79f8322dab6d1.tar.gz OSSE-5dc49ccef08a86430a597ec63cf79f8322dab6d1.tar.bz2 OSSE-5dc49ccef08a86430a597ec63cf79f8322dab6d1.zip |
Indexer: Hold indexer lock for less time when in search endpoint
-rw-r--r-- | indexer/src/main.rs | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/indexer/src/main.rs b/indexer/src/main.rs index 7d5a1af..8d738cd 100644 --- a/indexer/src/main.rs +++ b/indexer/src/main.rs @@ -161,8 +161,6 @@ async fn search( data: web::Data<AppState>, path: web::Path<OptSearchPath>, ) -> impl Responder { - let indexer = data.indexer.lock().unwrap(); - let query = match &path.query { Some(query) => query, None => return "[]".to_string(), @@ -170,8 +168,8 @@ async fn search( println!("Query: {:?}", query); - let results = indexer.search(query); - //+is lowercase search good (we turn ascii lowercase, what do we do with inserting) + let results = data.indexer.lock().unwrap().search(query); + //indexer is slow (gets stuck when inserting stuff) serde_json::to_string(&results.unwrap()).unwrap() } |