Skip to content

Commit e3eae54

Browse files
committed
Add missing step
1 parent 8256698 commit e3eae54

File tree

1 file changed

+29
-23
lines changed

1 file changed

+29
-23
lines changed

doctests/search-quickstart.js

Lines changed: 29 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,12 @@ import assert from "assert";
55
// HIDE_START
66
import {AggregateGroupByReducers, AggregateSteps, createClient, SchemaFieldTypes} from 'redis';
77

8+
// STEP_START connect
89
const client = createClient();
910
client.on('error', err => console.log('Redis Client Error', err));
1011

1112
await client.connect();
13+
// STEP_END
1214

1315
// HIDE_END
1416
// STEP_START data_sample
@@ -89,30 +91,34 @@ let bicycles = [
8991
},
9092
]
9193
// STEP_START define_index
94+
let schema = {
95+
'$.brand': {
96+
type: SchemaFieldTypes.TEXT,
97+
sortable: true,
98+
AS: 'brand'
99+
},
100+
'$.model': {
101+
type: SchemaFieldTypes.TEXT,
102+
AS: 'model'
103+
},
104+
'$.description': {
105+
type: SchemaFieldTypes.TEXT,
106+
AS: 'description'
107+
},
108+
'$.price': {
109+
type: SchemaFieldTypes.NUMERIC,
110+
AS: 'price'
111+
},
112+
'$.condition': {
113+
type: SchemaFieldTypes.TAG,
114+
AS: 'condition'
115+
},
116+
}
117+
// STEP_END
118+
119+
// STEP_START create_index
92120
try {
93-
await client.ft.create('idx:bicycle', {
94-
'$.brand': {
95-
type: SchemaFieldTypes.TEXT,
96-
sortable: true,
97-
AS: 'brand'
98-
},
99-
'$.model': {
100-
type: SchemaFieldTypes.TEXT,
101-
AS: 'model'
102-
},
103-
'$.description': {
104-
type: SchemaFieldTypes.TEXT,
105-
AS: 'description'
106-
},
107-
'$.price': {
108-
type: SchemaFieldTypes.NUMERIC,
109-
AS: 'price'
110-
},
111-
'$.condition': {
112-
type: SchemaFieldTypes.TAG,
113-
AS: 'condition'
114-
},
115-
}, {
121+
await client.ft.create('idx:bicycle', schema, {
116122
ON: 'JSON',
117123
PREFIX: 'bicycle:'
118124
});

0 commit comments

Comments
 (0)