Skip to content

Commit 279752c

Browse files
sypharJoshua Nelson
authored and
Joshua Nelson
committed
switch from LIKE to ILIKE for better readability
1 parent 0a3297d commit 279752c

File tree

1 file changed

+2
-13
lines changed

1 file changed

+2
-13
lines changed

src/web/sitemap.rs

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -59,21 +59,10 @@ pub fn sitemap_handler(req: &mut Request) -> IronResult<Response> {
5959
INNER JOIN releases ON releases.crate_id = crates.id
6060
WHERE
6161
rustdoc_status = true AND
62-
(
63-
crates.name like $1 OR
64-
crates.name like $2
65-
)
62+
crates.name ILIKE $1
6663
GROUP BY crates.name
6764
",
68-
&[
69-
// postgres can use the normal BTREE index on `name`
70-
// for LIKE queries, if they are anchored to the
71-
// beginning of the string.
72-
// This does not work for ILIKE and alphabetic
73-
// characters, hence the OR.
74-
&format!("{}%", letter),
75-
&format!("{}%", letter.to_uppercase()),
76-
],
65+
&[&format!("{}%", letter)],
7766
)
7867
.unwrap();
7968

0 commit comments

Comments
 (0)