| 1 |
import { RedisCommandArguments } from "@redis/client/dist/lib/commands"; |
| 2 |
import { pushSearchOptions } from "."; |
| 3 |
import { SearchOptions, SearchRawReply } from "./SEARCH"; |
| 4 |
|
| 5 |
export const FIRST_KEY_INDEX = 1; |
| 6 |
|
| 7 |
export const IS_READ_ONLY = true; |
| 8 |
|
| 9 |
export function transformArguments( |
| 10 |
index: string, |
| 11 |
query: string, |
| 12 |
options?: SearchOptions |
| 13 |
): RedisCommandArguments { |
| 14 |
return pushSearchOptions( |
| 15 |
['FT.SEARCH', index, query, 'NOCONTENT'], |
| 16 |
options |
| 17 |
); |
| 18 |
} |
| 19 |
|
| 20 |
export interface SearchNoContentReply { |
| 21 |
total: number; |
| 22 |
documents: Array<string>; |
| 23 |
}; |
| 24 |
|
| 25 |
export function transformReply(reply: SearchRawReply): SearchNoContentReply { |
| 26 |
return { |
| 27 |
total: reply[0], |
| 28 |
documents: reply.slice(1) |
| 29 |
}; |
| 30 |
} |