From 2b4c4a0fcfb3a6d40d0c4b05068870bf7d3f7d1c Mon Sep 17 00:00:00 2001 From: Nikolay Karadzhov Date: Wed, 4 Jun 2025 18:10:54 +0300 Subject: [PATCH] fix(search): align ft.search with server as per the ft.search docs ( https://redis.io/docs/latest/commands/ft.search ): If a relevant key expires while a query is running, an attempt to load the key's value will return a null array. However, the key is still counted in the total number of results. So, instead of crashing when seeing a null as a value, we return empty object. fixes #2772 see https://github.com/redis/node-redis/pull/2814 --- packages/search/lib/commands/SEARCH.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/search/lib/commands/SEARCH.ts b/packages/search/lib/commands/SEARCH.ts index abc561dff4..b8efda0577 100644 --- a/packages/search/lib/commands/SEARCH.ts +++ b/packages/search/lib/commands/SEARCH.ts @@ -221,6 +221,10 @@ export interface SearchReply { function documentValue(tuples: any) { const message = Object.create(null); + if(!tuples) { + return message; + } + let i = 0; while (i < tuples.length) { const key = tuples[i++],