Skip to content

Commit 2b4c4a0

Browse files
committed
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 redis#2772 see redis#2814
1 parent b33a662 commit 2b4c4a0

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

packages/search/lib/commands/SEARCH.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,10 @@ export interface SearchReply {
221221
function documentValue(tuples: any) {
222222
const message = Object.create(null);
223223

224+
if(!tuples) {
225+
return message;
226+
}
227+
224228
let i = 0;
225229
while (i < tuples.length) {
226230
const key = tuples[i++],

0 commit comments

Comments
 (0)