Skip to content

Implement FT.ADD, FT.DEL, FT.GET, FT.MGET, FT.DROP #5958

@vyavdoshenko

Description

@vyavdoshenko

Implement deprecated commands as wrappers over existing commands to enable backward compatibility.

Commands to implement:

FT.ADD - Add document to index
Syntax: FT.ADD {index} {docId} {score} FIELDS {field} {value} [{field} {value}...]

Implementation:

  1. Get index prefix from DocIndex
  2. Build key: prefix + docId
  3. Call HSET {key} {field} {value} ...
  4. Return "OK"

FT.GET - Retrieve document from index
Syntax: FT.GET {index} {docId}

Implementation:

  1. Get index prefix from DocIndex
  2. Build key: prefix + docId
  3. Call HGETALL {key}
  4. Return result (or Nil if not found)

FT.MGET - Retrieve multiple documents
Syntax: FT.MGET {index} {docId} [{docId} ...]

Implementation:

  1. Loop through each docId
  2. Call FT.GET for each
  3. Return an array of results

FT.DEL - Delete document from index
Syntax: FT.DEL {index} {docId} [DD]

Implementation:

  1. Get index prefix from DocIndex
  2. Build key: prefix + docId
  3. Call DEL {key} (if DD flag present)
  4. Return 1 if deleted, 0 otherwise

FT.DROP {index}
Alias to existing FT.DROPINDEX

These commands are deprecated since RediSearch 2.0, but still maintained for backwards compatibility.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions