From c567002b58869ca2a38f3073b420f0df0247686e Mon Sep 17 00:00:00 2001 From: Andrew Douglas Date: Sun, 20 Aug 2023 17:00:54 +0100 Subject: [PATCH] Improve handling of RediSearch "unknown: index name" error Fixes issue where RediSearch responds with a message that uses inconsistent case. Solution: Lowercase the message before comparison. --- src/redis_utils.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/redis_utils.rs b/src/redis_utils.rs index b696456..cf3b727 100644 --- a/src/redis_utils.rs +++ b/src/redis_utils.rs @@ -11,7 +11,7 @@ pub fn ensure_redisearch_index( let index_info: Result = 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")