Skip to content

Commit

Permalink
Added less strict search.
Browse files Browse the repository at this point in the history
  • Loading branch information
SamTV12345 committed Nov 16, 2023
1 parent 73eca04 commit d21e0b8
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/models/favorites.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,10 +198,12 @@ impl Favorite{
}
}

if title.is_some() {
sql_function!(fn lower(x: Text) -> Text);

if let Some(title) = title {
use crate::dbconfig::schema::podcasts::dsl::name as podcasttitle;
query = query
.filter(podcasttitle.like(format!("%{}%", title.unwrap())));
.filter(lower(podcasttitle).like(format!("%{}%", title.to_lowercase())));
}

let mut matching_podcast_ids = vec![];
Expand Down

0 comments on commit d21e0b8

Please sign in to comment.