Skip to content

Commit 8992b63

Browse files
authored
RI-7192: add generateFtCreateCommand() util (#4715)
1 parent d69f0c5 commit 8992b63

File tree

2 files changed

+43
-0
lines changed

2 files changed

+43
-0
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import { generateFtCreateCommand } from './generateFtCreateCommand'
2+
3+
describe('generateFtCreateCommand', () => {
4+
it('returns the expected hardcoded FT.CREATE command', () => {
5+
const result = generateFtCreateCommand()
6+
7+
expect(result).toBe(`FT.CREATE idx:bikes_vss
8+
ON HASH
9+
PREFIX 1 "bikes:"
10+
SCHEMA
11+
"model" TEXT NOSTEM SORTABLE
12+
"brand" TEXT NOSTEM SORTABLE
13+
"price" NUMERIC SORTABLE
14+
"type" TAG
15+
"material" TAG
16+
"weight" NUMERIC SORTABLE
17+
"description_embeddings" VECTOR "FLAT" 10
18+
"TYPE" FLOAT32
19+
"DIM" 768
20+
"DISTANCE_METRIC" "L2"
21+
"INITIAL_CAP" 111
22+
"BLOCK_SIZE" 111`)
23+
})
24+
})
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// TODO: Since v1 would use predefined data, return a hardcoded command
2+
// instead of generating it dynamically.
3+
4+
export const generateFtCreateCommand = (): string => `FT.CREATE idx:bikes_vss
5+
ON HASH
6+
PREFIX 1 "bikes:"
7+
SCHEMA
8+
"model" TEXT NOSTEM SORTABLE
9+
"brand" TEXT NOSTEM SORTABLE
10+
"price" NUMERIC SORTABLE
11+
"type" TAG
12+
"material" TAG
13+
"weight" NUMERIC SORTABLE
14+
"description_embeddings" VECTOR "FLAT" 10
15+
"TYPE" FLOAT32
16+
"DIM" 768
17+
"DISTANCE_METRIC" "L2"
18+
"INITIAL_CAP" 111
19+
"BLOCK_SIZE" 111`

0 commit comments

Comments
 (0)