Skip to content

Commit e9ee84c

Browse files
committed
Add support for NOCONTENT in FT.SEARCH
1 parent 294cbf8 commit e9ee84c

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

packages/search/lib/commands/SEARCH.spec.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,13 @@ describe('SEARCH', () => {
1212
);
1313
});
1414

15+
it('with NOCONTENT', () => {
16+
assert.deepEqual(
17+
transformArguments('index', 'query', { NOCONTENT: true }),
18+
['FT.SEARCH', 'index', 'query', 'NOCONTENT']
19+
);
20+
});
21+
1522
it('with VERBATIM', () => {
1623
assert.deepEqual(
1724
transformArguments('index', 'query', { VERBATIM: true }),

packages/search/lib/commands/SEARCH.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export const FIRST_KEY_INDEX = 1;
66
export const IS_READ_ONLY = true;
77

88
export interface SearchOptions {
9-
// NOCONTENT?: true; TODO
9+
NOCONTENT?: true;
1010
VERBATIM?: true;
1111
NOSTOPWORDS?: true;
1212
// WITHSCORES?: true;

packages/search/lib/commands/index.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -395,6 +395,10 @@ export function pushSearchOptions(
395395
args: RedisCommandArguments,
396396
options?: SearchOptions
397397
): RedisCommandArguments {
398+
if (options?.NOCONTENT) {
399+
args.push('NOCONTENT');
400+
}
401+
398402
if (options?.VERBATIM) {
399403
args.push('VERBATIM');
400404
}

0 commit comments

Comments
 (0)