File tree Expand file tree Collapse file tree 2 files changed +43
-0
lines changed
redisinsight/ui/src/utils/index Expand file tree Collapse file tree 2 files changed +43
-0
lines changed Original file line number Diff line number Diff line change
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
+ } )
Original file line number Diff line number Diff line change
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`
You can’t perform that action at this time.
0 commit comments