Make user fuzzy search case-insensitive

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
This commit is contained in:
Antonio Scandurra 2022-05-10 17:30:09 +02:00
parent 93688cbe22
commit b00338195e

View file

@ -125,7 +125,7 @@ impl Db for PostgresDb {
let query = " let query = "
SELECT users.* SELECT users.*
FROM users FROM users
WHERE github_login like $1 WHERE github_login ILIKE $1
ORDER BY github_login <-> $2 ORDER BY github_login <-> $2
LIMIT $3 LIMIT $3
"; ";
@ -898,7 +898,7 @@ pub mod tests {
let test_db = TestDb::postgres().await; let test_db = TestDb::postgres().await;
let db = test_db.db(); let db = test_db.db();
for github_login in [ for github_login in [
"california", "California",
"colorado", "colorado",
"oregon", "oregon",
"washington", "washington",
@ -911,7 +911,7 @@ pub mod tests {
assert_eq!( assert_eq!(
fuzzy_search_user_names(db, "clr").await, fuzzy_search_user_names(db, "clr").await,
&["colorado", "california"] &["colorado", "California"]
); );
assert_eq!( assert_eq!(
fuzzy_search_user_names(db, "ro").await, fuzzy_search_user_names(db, "ro").await,