Sitelet https://github.com/redis/node-redis/pull/3157
Skip to content

FT.CREATE improvements - #3157

Merged
nkaradzhov merged 1 commit into
redis:masterfrom
nkaradzhov:search-fixes
Jan 15, 2026
Merged

nkaradzhov merged 1 commit into
redis:masterfrom
nkaradzhov:search-fixes

Conversation

@nkaradzhov

Copy link
Copy Markdown
Collaborator

Description

  • Fix SCHEMA_TEXT_FIELD_PHONETIC key typo (FM_PT → DM_PT)
  • Allow same field to be indexed multiple times with different types/aliases via array syntax

Checklist

  • Does npm test pass with this change (including linting)?
  • Is the new or changed code fully tested?
  • Is a documentation update included (if this change modifies existing APIs, or introduces new ones)?

…nt configurations

Allow RediSearchSchema to accept an array of field definitions for a single field,
enabling the same field to be indexed with different types and aliases.

Example:
```typescript
{
  sku: [
    { type: SCHEMA_FIELD_TYPE.TEXT, AS: 'sku_text' },
    { type: SCHEMA_FIELD_TYPE.TAG, AS: 'sku_tag', SORTABLE: true }
  ]
}
```

- Add SchemaFieldDefinition type for reusable field type union
- Update RediSearchSchema to accept SchemaFieldDefinition | SchemaFieldDefinition[]
- Update parseSchema to normalize input and iterate over field definition arrays

---

- fix typo in PT SCHEMA_TEXT_FIELD_PHONETIC

- Add JSDoc and README documentation for the new array syntax that allows
indexing the same field multiple times with different types or aliases.
@jit-ci

jit-ci Bot commented Jan 15, 2026

Copy link
Copy Markdown

Hi, I’m Jit, a friendly security platform designed to help developers build secure applications from day zero with an MVS (Minimal viable security) mindset.

In case there are security findings, they will be communicated to you as a comment inside the PR.

Hope you’ll enjoy using Jit.

Questions? Comments? Want to learn more? Get in touch with us.

@jit-ci

jit-ci Bot commented Jan 15, 2026

Copy link
Copy Markdown

❌ Security scan failed

Security scan failed: Branch search-fixes does not exist in the remote repository


💡 Need to bypass this check? Comment @sera bypass to override.

Comment on lines +178 to +182
for (const [field, fieldOptionsOrArray] of Object.entries(schema)) {
// Normalize to array for uniform processing
const fieldOptionsList = Array.isArray(fieldOptionsOrArray)
? fieldOptionsOrArray
: [fieldOptionsOrArray];

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the actual change, rest is formatting...

@bobymicroby bobymicroby left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@nkaradzhov
nkaradzhov merged commit 3faad10 into redis:master Jan 15, 2026
15 checks passed
@nkaradzhov
nkaradzhov deleted the search-fixes branch January 15, 2026 15:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants