Skip to content

Commit

Permalink
Improve handling of RediSearch "unknown: index name" error
Browse files Browse the repository at this point in the history
Fixes issue where RediSearch responds with a message that uses inconsistent case.

Solution: Lowercase the message before comparison.
  • Loading branch information
andrewkdouglas authored Aug 20, 2023
1 parent 3a1dcf6 commit c567002
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/redis_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ pub fn ensure_redisearch_index(
let index_info: Result<redis::Value, _> = redis::cmd("FT.INFO").arg(index_name).query(&mut con);

if let Err(err) = index_info {
if err.to_string().contains("Unknown: Index name") {
if err.to_string().to_lowercase().contains("unknown: index name") {
redis::cmd("FT.CREATE")
.arg(index_name)
.arg("ON")
Expand Down

0 comments on commit c567002

Please sign in to comment.