We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
count
FT.CURSOR READ
1 parent d4f1943 commit 85091cdCopy full SHA for 85091cd
2 files changed
packages/search/lib/commands/CURSOR_READ.spec.ts
@@ -4,15 +4,24 @@ import testUtils, { GLOBAL } from '../test-utils';
4
import { transformArguments } from './CURSOR_READ';
5
6
describe('CURSOR READ', () => {
7
- it('transformArguments', () => {
8
- assert.deepEqual(
9
- transformArguments('index', 0),
10
- ['FT.CURSOR', 'READ', 'index', '0']
11
- );
+ describe('transformArguments', () => {
+ it('without options', () => {
+ assert.deepEqual(
+ transformArguments('index', 0),
+ ['FT.CURSOR', 'READ', 'index', '0']
12
+ );
13
+ });
14
+
15
+ it('with COUNT', () => {
16
17
+ transformArguments('index', 0, { COUNT: 1 }),
18
+ ['FT.CURSOR', 'READ', 'index', '0', 'COUNT', '1']
19
20
21
});
22
23
testUtils.testWithClient('client.ft.cursorRead', async client => {
- const [ ,, { cursor } ] = await Promise.all([
24
+ const [, , { cursor }] = await Promise.all([
25
client.ft.create('idx', {
26
field: {
27
type: SchemaFieldTypes.TEXT
packages/search/lib/commands/CURSOR_READ.ts
@@ -4,16 +4,27 @@ export const FIRST_KEY_INDEX = 1;
export const IS_READ_ONLY = true;
+interface CursorReadOptions {
+ COUNT?: number;
+}
export function transformArguments(
index: RedisCommandArgument,
- cursor: number
+ cursor: number,
+ options?: CursorReadOptions
): RedisCommandArguments {
- return [
+ const args = [
'FT.CURSOR',
'READ',
index,
cursor.toString()
];
+ if (options?.COUNT) {
+ args.push('COUNT', options.COUNT.toString());
+ }
+ return args;
28
}
29
30
export { transformReply } from './AGGREGATE_WITHCURSOR';
0 commit comments