Skip to content

Commit 1e53b6b

Browse files
committed
(docs) search: add jsdocs for all commands
1 parent 4b32ca7 commit 1e53b6b

34 files changed

+261
-0
lines changed

packages/search/lib/commands/AGGREGATE.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,18 @@ export interface AggregateReply {
141141
export default {
142142
NOT_KEYED_COMMAND: true,
143143
IS_READ_ONLY: false,
144+
/**
145+
* Performs an aggregation query on a RediSearch index.
146+
* @param parser - The command parser
147+
* @param index - The index name to query
148+
* @param query - The text query to use as filter, use * to indicate no filtering
149+
* @param options - Optional parameters for aggregation:
150+
* - VERBATIM: disable stemming in query evaluation
151+
* - LOAD: specify fields to load from documents
152+
* - STEPS: sequence of aggregation steps (GROUPBY, SORTBY, APPLY, LIMIT, FILTER)
153+
* - PARAMS: bind parameters for query evaluation
154+
* - TIMEOUT: maximum time to run the query
155+
*/
144156
parseCommand(parser: CommandParser, index: RedisArgument, query: RedisArgument, options?: FtAggregateOptions) {
145157
parser.push('FT.AGGREGATE', index, query);
146158

packages/search/lib/commands/AGGREGATE_WITHCURSOR.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,16 @@ export interface AggregateWithCursorReply extends AggregateReply {
1919

2020
export default {
2121
IS_READ_ONLY: AGGREGATE.IS_READ_ONLY,
22+
/**
23+
* Performs an aggregation with a cursor for retrieving large result sets.
24+
* @param parser - The command parser
25+
* @param index - Name of the index to query
26+
* @param query - The aggregation query
27+
* @param options - Optional parameters:
28+
* - All options supported by FT.AGGREGATE
29+
* - COUNT: Number of results to return per cursor fetch
30+
* - MAXIDLE: Maximum idle time for cursor in milliseconds
31+
*/
2232
parseCommand(parser: CommandParser, index: RedisArgument, query: RedisArgument, options?: FtAggregateWithCursorOptions) {
2333
AGGREGATE.parseCommand(parser, index, query, options);
2434
parser.push('WITHCURSOR');

packages/search/lib/commands/ALIASADD.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ import { RedisArgument, SimpleStringReply, Command } from '@redis/client/dist/li
44
export default {
55
NOT_KEYED_COMMAND: true,
66
IS_READ_ONLY: true,
7+
/**
8+
* Adds an alias to a RediSearch index.
9+
* @param parser - The command parser
10+
* @param alias - The alias to add
11+
* @param index - The index name to alias
12+
*/
713
parseCommand(parser: CommandParser, alias: RedisArgument, index: RedisArgument) {
814
parser.push('FT.ALIASADD', alias, index);
915
},

packages/search/lib/commands/ALIASDEL.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ import { RedisArgument, SimpleStringReply, Command } from '@redis/client/dist/li
44
export default {
55
NOT_KEYED_COMMAND: true,
66
IS_READ_ONLY: true,
7+
/**
8+
* Removes an existing alias from a RediSearch index.
9+
* @param parser - The command parser
10+
* @param alias - The alias to remove
11+
*/
712
parseCommand(parser: CommandParser, alias: RedisArgument) {
813
parser.push('FT.ALIASDEL', alias);
914
},

packages/search/lib/commands/ALIASUPDATE.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ import { SimpleStringReply, Command, RedisArgument } from '@redis/client/dist/li
44
export default {
55
NOT_KEYED_COMMAND: true,
66
IS_READ_ONLY: true,
7+
/**
8+
* Updates the index pointed to by an existing alias.
9+
* @param parser - The command parser
10+
* @param alias - The existing alias to update
11+
* @param index - The new index name that the alias should point to
12+
*/
713
parseCommand(parser: CommandParser, alias: RedisArgument, index: RedisArgument) {
814
parser.push('FT.ALIASUPDATE', alias, index);
915
},

packages/search/lib/commands/ALTER.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ import { RediSearchSchema, parseSchema } from './CREATE';
55
export default {
66
NOT_KEYED_COMMAND: true,
77
IS_READ_ONLY: true,
8+
/**
9+
* Alters an existing RediSearch index schema by adding new fields.
10+
* @param parser - The command parser
11+
* @param index - The index to alter
12+
* @param schema - The schema definition containing new fields to add
13+
*/
814
parseCommand(parser: CommandParser, index: RedisArgument, schema: RediSearchSchema) {
915
parser.push('FT.ALTER', index, 'SCHEMA', 'ADD');
1016
parseSchema(parser, schema);

packages/search/lib/commands/CONFIG_GET.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ import { ArrayReply, TuplesReply, BlobStringReply, NullReply, UnwrapReply, Comma
44
export default {
55
NOT_KEYED_COMMAND: true,
66
IS_READ_ONLY: true,
7+
/**
8+
* Gets a RediSearch configuration option value.
9+
* @param parser - The command parser
10+
* @param option - The name of the configuration option to retrieve
11+
*/
712
parseCommand(parser: CommandParser, option: string) {
813
parser.push('FT.CONFIG', 'GET', option);
914
},

packages/search/lib/commands/CONFIG_SET.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@ type FtConfigProperties = 'a' | 'b' | (string & {}) | Buffer;
88
export default {
99
NOT_KEYED_COMMAND: true,
1010
IS_READ_ONLY: true,
11+
/**
12+
* Sets a RediSearch configuration option value.
13+
* @param parser - The command parser
14+
* @param property - The name of the configuration option to set
15+
* @param value - The value to set for the configuration option
16+
*/
1117
parseCommand(parser: CommandParser, property: FtConfigProperties, value: RedisArgument) {
1218
parser.push('FT.CONFIG', 'SET', property, value);
1319
},

packages/search/lib/commands/CREATE.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,22 @@ export interface CreateOptions {
292292
export default {
293293
NOT_KEYED_COMMAND: true,
294294
IS_READ_ONLY: true,
295+
/**
296+
* Creates a new search index with the given schema and options.
297+
* @param parser - The command parser
298+
* @param index - Name of the index to create
299+
* @param schema - Index schema defining field names and types (TEXT, NUMERIC, GEO, TAG, VECTOR, GEOSHAPE)
300+
* @param options - Optional parameters:
301+
* - ON: Type of container to index (HASH or JSON)
302+
* - PREFIX: Prefixes for document keys to index
303+
* - FILTER: Expression that filters indexed documents
304+
* - LANGUAGE/LANGUAGE_FIELD: Default language for indexing
305+
* - SCORE/SCORE_FIELD: Document ranking parameters
306+
* - MAXTEXTFIELDS: Index all text fields without specifying them
307+
* - TEMPORARY: Create a temporary index
308+
* - NOOFFSETS/NOHL/NOFIELDS/NOFREQS: Index optimization flags
309+
* - STOPWORDS: Custom stopword list
310+
*/
295311
parseCommand(parser: CommandParser, index: RedisArgument, schema: RediSearchSchema, options?: CreateOptions) {
296312
parser.push('FT.CREATE', index);
297313

packages/search/lib/commands/CURSOR_DEL.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ import { SimpleStringReply, Command, RedisArgument, NumberReply, UnwrapReply } f
44
export default {
55
NOT_KEYED_COMMAND: true,
66
IS_READ_ONLY: true,
7+
/**
8+
* Deletes a cursor from an index.
9+
* @param parser - The command parser
10+
* @param index - The index name that contains the cursor
11+
* @param cursorId - The cursor ID to delete
12+
*/
713
parseCommand(parser: CommandParser, index: RedisArgument, cursorId: UnwrapReply<NumberReply>) {
814
parser.push('FT.CURSOR', 'DEL', index, cursorId.toString());
915
},

0 commit comments

Comments
 (0)