You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-06 02:15:48 +03:00
Add support for FT.SEARCH NOCONTENT
(#2610)
* Add support for NOCONTENT in FT.SEARCH * Move support for NOCONTENT search option from client.search to client.searchNoContent * Add test for SEARCH_NOCONTENT#transformReply * Fix typo * Enable test * Update test field type --------- Co-authored-by: Leibale <me@leibale.com>
This commit is contained in:
30
packages/search/lib/commands/SEARCH_NOCONTENT.ts
Normal file
30
packages/search/lib/commands/SEARCH_NOCONTENT.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
import { RedisCommandArguments } from "@redis/client/dist/lib/commands";
|
||||
import { pushSearchOptions } from ".";
|
||||
import { SearchOptions, SearchRawReply } from "./SEARCH";
|
||||
|
||||
export const FIRST_KEY_INDEX = 1;
|
||||
|
||||
export const IS_READ_ONLY = true;
|
||||
|
||||
export function transformArguments(
|
||||
index: string,
|
||||
query: string,
|
||||
options?: SearchOptions
|
||||
): RedisCommandArguments {
|
||||
return pushSearchOptions(
|
||||
['FT.SEARCH', index, query, 'NOCONTENT'],
|
||||
options
|
||||
);
|
||||
}
|
||||
|
||||
export interface SearchNoContentReply {
|
||||
total: number;
|
||||
documents: Array<string>;
|
||||
};
|
||||
|
||||
export function transformReply(reply: SearchRawReply): SearchNoContentReply {
|
||||
return {
|
||||
total: reply[0],
|
||||
documents: reply.slice(1)
|
||||
};
|
||||
}
|
Reference in New Issue
Block a user