about summary refs log tree commit diff
diff options
context:
space:
mode:
authorBaitinq <manuelpalenzuelamerino@gmail.com>2022-10-30 18:11:42 +0100
committerBaitinq <manuelpalenzuelamerino@gmail.com>2022-10-30 18:11:53 +0100
commit0b6ef19c1532209dcd2a18e6bbbaa23cad353008 (patch)
tree9e91552eef114e0cae5e95b0d7038d387a824027
parentFrontend: URL encode and decode the search_query (diff)
downloadOSSE-0b6ef19c1532209dcd2a18e6bbbaa23cad353008.tar.gz
OSSE-0b6ef19c1532209dcd2a18e6bbbaa23cad353008.tar.bz2
OSSE-0b6ef19c1532209dcd2a18e6bbbaa23cad353008.zip
Indexer: Transform all queries into lowercase
This is because currently then reverse index only contains lowercase
words as it transforms them when inserting them.
-rw-r--r--indexer/src/main.rs3
1 files changed, 3 insertions, 0 deletions
diff --git a/indexer/src/main.rs b/indexer/src/main.rs
index 18604a6..36bd8de 100644
--- a/indexer/src/main.rs
+++ b/indexer/src/main.rs
@@ -106,6 +106,9 @@ async fn search(data: web::Data<AppState>, term: web::Path<String>) -> impl Resp
     //percentage of valid words
     let mut valid_results: Option<HashSet<IndexedResource>> = None;
     for w in query {
+        //Normalise queries to lowercase
+        let w = w.to_ascii_lowercase();
+
         let curr_word_results = match search_word_in_db(&database, w.to_string()) {
             None => return "[]".to_string(),
             Some(curr_results) => curr_results,