1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-09 00:22:08 +03:00
Files
node-redis/packages/search/lib/commands/SUGGET.ts
2023-10-11 17:04:13 -04:00

26 lines
690 B
TypeScript

import { NullReply, ArrayReply, BlobStringReply, Command, RedisArgument } from '@redis/client/dist/lib/RESP/types';
export interface FtSugGetOptions {
FUZZY?: boolean;
MAX?: number;
}
export default {
FIRST_KEY_INDEX: undefined,
IS_READ_ONLY: true,
transformArguments(key: RedisArgument, prefix: RedisArgument, options?: FtSugGetOptions) {
const args = ['FT.SUGGET', key, prefix];
if (options?.FUZZY) {
args.push('FUZZY');
}
if (options?.MAX !== undefined) {
args.push('MAX', options.MAX.toString());
}
return args;
},
transformReply: undefined as unknown as () => NullReply | ArrayReply<BlobStringReply>
} as const satisfies Command;