Commit 3faad10
authored
feat(search): support indexing same field multiple times with different configurations (redis#3157)
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.1 parent 591e7f7 commit 3faad10
File tree
3 files changed
+195
-126
lines changed- packages/search
- lib/commands
3 files changed
+195
-126
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
35 | 53 | | |
36 | 54 | | |
37 | 55 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
332 | 332 | | |
333 | 333 | | |
334 | 334 | | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
335 | 357 | | |
336 | 358 | | |
337 | 359 | | |
| |||
0 commit comments