1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-06 02:15:48 +03:00
Files
node-redis/packages/search/lib/commands/SEARCH_NOCONTENT.ts
Hristo Temelski 1af01373db feat(search): Set default dialect to 2 for Redis Search commands (#2895)
- The default dialect `DEFAULT_DIALECT`  is now set to '2'
- Automatically append DIALECT parameter to search commands when not explicitly specified
2025-02-17 13:47:12 +02:00

26 lines
724 B
TypeScript

import { Command, ReplyUnion } from '@redis/client/dist/lib/RESP/types';
import SEARCH, { SearchRawReply } from './SEARCH';
export default {
NOT_KEYED_COMMAND: SEARCH.NOT_KEYED_COMMAND,
IS_READ_ONLY: SEARCH.IS_READ_ONLY,
parseCommand(...args: Parameters<typeof SEARCH.parseCommand>) {
SEARCH.parseCommand(...args);
args[0].push('NOCONTENT');
},
transformReply: {
2: (reply: SearchRawReply): SearchNoContentReply => {
return {
total: reply[0],
documents: reply.slice(1)
}
},
3: undefined as unknown as () => ReplyUnion
},
unstableResp3: true
} as const satisfies Command;
export interface SearchNoContentReply {
total: number;
documents: Array<string>;
};