Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Redisearch

Hierarchy

  • Module
    • Redisearch

Index

Constructors

  • new Redisearch(clusterNodes: ClusterNode[], moduleOptions?: RedisModuleOptions, clusterOptions?: ClusterOptions): Redisearch
  • new Redisearch(redisOptions: RedisOptions, moduleOptions?: RedisModuleOptions): Redisearch
  • Initializing the module object

    Parameters

    • clusterNodes: ClusterNode[]

      The nodes of the cluster

    • Optional moduleOptions: RedisModuleOptions

      The additional module options

    • Optional clusterOptions: ClusterOptions

      The options of the clusters

    Returns Redisearch

  • Initializing the module object

    Parameters

    • redisOptions: RedisOptions

      The options of the redis database

    • Optional moduleOptions: RedisModuleOptions

      The additional module options

    Returns Redisearch

Properties

cluster: Cluster
clusterNodes: ClusterNode[]
clusterOptions: ClusterOptions
isHandleError: boolean
name: string
redis: Redis
redisOptions: RedisOptions
returnRawResponse: boolean
searchCommander: SearchCommander = ...
searchHelpers: RedisearchHelpers = ...
showDebugLogs: boolean

Methods

  • Runs a search query on an index, and performs aggregate transformations on the results, extracting statistics etc from them

    Parameters

    • index: string

      The index

    • query: string

      The query

    • Optional parameters: FTAggregateParameters

      The additional optional parameters

    Returns Promise<FTAggregateResponse>

    Array Response. Each row is an array and represents a single aggregate result

  • aliasadd(name: string, index: string): Promise<string>
  • Adding alias fron an index

    Parameters

    • name: string

      The alias name

    • index: string

      The alias index

    Returns Promise<string>

    'OK' or error

  • aliasdel(name: string): Promise<string>
  • aliasupdate(name: string, index: string): Promise<string>
  • alter(index: string, field: string, fieldType: string, options?: FTFieldOptions): Promise<string>
  • Adding a new field to the index

    Parameters

    • index: string

      The index

    • field: string

      The field name

    • fieldType: string

      The field type

    • Optional options: FTFieldOptions

      The additional optional parameters

    Returns Promise<string>

    'OK' or error

  • config(commandType: "GET" | "SET" | "HELP", option: string, value?: string): Promise<FTConfig>
  • Retrieves, describes and sets runtime configuration options

    Parameters

    • commandType: "GET" | "SET" | "HELP"

      The command type

    • option: string

      The option

    • Optional value: string

      In case of 'SET' command, a valid value to set

    Returns Promise<FTConfig>

    If 'SET' command, returns 'OK' for valid runtime-settable option names and values. If 'GET' command, returns a string with the current option's value.

  • connect(): Promise<void>
  • Connecting to the Redis database with the module

    Returns Promise<void>

  • dictadd(dict: string, terms: string[]): Promise<number>
  • Adding terms to a dictionary

    Parameters

    • dict: string

      The dictionary

    • terms: string[]

      A list of terms

    Returns Promise<number>

    The number of new terms that were added

  • dictdel(dict: string, terms: string[]): Promise<number>
  • Deleting terms from a dictionary

    Parameters

    • dict: string

      The dictionary

    • terms: string[]

      A list of terms

    Returns Promise<number>

    The number of terms that were deleted

  • dictdump(dict: string): Promise<string>
  • Dumps all terms in the given dictionary

    Parameters

    • dict: string

      The dictionary

    Returns Promise<string>

    An array, where each element is term

  • disconnect(): Promise<void>
  • Disconnecting from the Redis database with the module

    Returns Promise<void>

  • dropindex(index: string, deleteHash?: boolean): Promise<string>
  • Deleting the index

    Parameters

    • index: string

      The index

    • deleteHash: boolean = false

      If set, the drop operation will delete the actual document hashes.

    Returns Promise<string>

    'OK' or error

  • explain(index: string, query: string): Promise<string>
  • Retrieving the execution plan for a complex query

    Parameters

    • index: string

      The index

    • query: string

      The query

    Returns Promise<string>

    Returns the execution plan for a complex query

  • explainCLI(index: string, query: string): Promise<string[]>
  • Retrieving the execution plan for a complex query but formatted for easier reading without using redis-cli --raw

    Parameters

    • index: string

      The index

    • query: string

      The query

    Returns Promise<string[]>

    A string representing the execution plan.

  • handleError(error: string): any
  • Handling a error

    Parameters

    • error: string

      The message of the error

    Returns any

  • handleResponse(response: any): any
  • Simpilizing the response of the Module command

    Parameters

    • response: any

      The array response from the module

    Returns any

  • info(index: string): Promise<FTInfo>
  • isOnlyTwoDimensionalArray(array: any[]): boolean
  • Check if array is fully two dimensional. Only items in the array are arrays.

    Parameters

    • array: any[]

      The potential two dimensional array

    Returns boolean

  • paramToString(paramValue: string): string
  • Formatting given param value to string

    Parameters

    • paramValue: string

      The given param value

    Returns string

    A param value converted to string

  • reduceArrayDimension(array: any[][]): any[]
  • Reducing an array by one level. i.e. from two dimensional to 1 dimensional.

    Parameters

    • array: any[][]

      The potentional two dimensional array

    Returns any[]

  • Searching the index with a textual query

    Parameters

    • index: string

      The index

    • query: string

      The query

    • Optional parameters: FTSearchParameters

      The additional optional parameter

    Returns Promise<FTSearchResponse>

    Array reply, where the first element is the total number of results, and then pairs of document id, and a nested array of field/value.

  • sendCommand(data: CommandData): Promise<any>
  • Running a Redis command

    Parameters

    • data: CommandData

      The command data of a command to send. Consists of command and args.

    Returns Promise<any>

  • sugadd(key: string, suggestion: string, score: number, options?: FTSugAddParameters): Promise<number>
  • Adds a suggestion string to an auto-complete suggestion dictionary

    Parameters

    • key: string

      The key

    • suggestion: string

      The suggestion

    • score: number

      The score

    • Optional options: FTSugAddParameters

      The additional optional parameters

    Returns Promise<number>

    The current size of the suggestion dictionary

  • sugdel(key: string, suggestion: string): Promise<number>
  • Retrieving completion suggestions for a prefix

    Parameters

    • key: string

      The key

    • prefix: string

      The prefix of the suggestion

    • Optional options: FTSugGetParameters

      The additional optional parameter

    Returns Promise<string>

    A list of the top suggestions matching the prefix, optionally with score after each entry

  • suglen(key: string): Promise<number>
  • syndump(index: string): Promise<{}>
  • Dumps the contents of a synonym group

    Parameters

    • index: string

      The index

    Returns Promise<{}>

    A list of synonym terms and their synonym group ids.

  • synupdate(index: string, groupId: number, terms: string[], skipInitialScan?: boolean): Promise<"OK">
  • Updating a synonym group

    Parameters

    • index: string

      The index

    • groupId: number

      The group id

    • terms: string[]

      A list of terms

    • skipInitialScan: boolean = false

      If set, we do not scan and index.

    Returns Promise<"OK">

    'OK'

  • tagvals(index: string, field: string): Promise<string[]>
  • Retrieving the distinct tags indexed in a Tag field

    Parameters

    • index: string

      The index

    • field: string

      The field name

    Returns Promise<string[]>

    The distinct tags indexed in a Tag field

Generated using TypeDoc