Skip to content

Commit a33dbb1

Browse files
DOC-4335 remove incomplete examples
1 parent f90b89d commit a33dbb1

File tree

1 file changed

+2
-85
lines changed

1 file changed

+2
-85
lines changed

doctests/query_agg_test.go

Lines changed: 2 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -266,92 +266,15 @@ func ExampleClient_query_agg() {
266266
// STEP_END
267267

268268
// STEP_START agg2
269-
res2, err := rdb.FTAggregateWithArgs(ctx,
270-
"idx:bicycle",
271-
"*",
272-
&redis.FTAggregateOptions{
273-
Apply: []redis.FTAggregateApply{
274-
{
275-
Field: "@price<1000",
276-
As: "price_category",
277-
},
278-
},
279-
GroupBy: []redis.FTAggregateGroupBy{
280-
{
281-
Fields: []interface{}{"@condition"},
282-
Reduce: []redis.FTAggregateReducer{
283-
{
284-
Reducer: redis.SearchSum,
285-
Args: []interface{}{"@price_category"},
286-
As: "num_affordable",
287-
},
288-
},
289-
},
290-
},
291-
Load: []redis.FTAggregateLoad{
292-
{Field: "@price"},
293-
},
294-
},
295-
).Result()
296269

297-
if err != nil {
298-
panic(err)
299-
}
300-
301-
fmt.Println(len(res2.Rows)) // >>> 3
270+
// Not currently implemented in go-redis.
302271

303-
sort.Slice(res2.Rows, func(i, j int) bool {
304-
return res2.Rows[i].Fields["condition"].(string) <
305-
res2.Rows[j].Fields["condition"].(string)
306-
})
307-
308-
for _, row := range res2.Rows {
309-
fmt.Printf(
310-
"condition=%v, num_affordable=%v\n",
311-
row.Fields["condition"],
312-
row.Fields["num_affordable"],
313-
)
314-
}
315272
// STEP_END
316273

317274
// STEP_START agg3
318-
res3, err := rdb.FTAggregateWithArgs(ctx,
319-
"idx:bicycle", "*",
320-
321-
&redis.FTAggregateOptions{
322-
Apply: []redis.FTAggregateApply{
323-
{
324-
Field: "bicycle",
325-
As: "type",
326-
},
327-
},
328-
GroupBy: []redis.FTAggregateGroupBy{
329-
{
330-
Fields: []interface{}{"@type"},
331-
Reduce: []redis.FTAggregateReducer{
332-
{
333-
Reducer: redis.SearchCount,
334-
As: "num_total",
335-
},
336-
},
337-
},
338-
},
339-
}).Result()
340275

341-
if err != nil {
342-
panic(err)
343-
}
344-
345-
fmt.Println(len(res3.Rows)) // >>> 1
276+
// Not currently implemented in go-redis.
346277

347-
for _, row := range res3.Rows {
348-
fmt.Printf(
349-
"type=%v, num_total=%v\n",
350-
row.Fields["type"],
351-
row.Fields["num_total"],
352-
)
353-
}
354-
// >>> type=bicycle, num_total=10
355278
// STEP_END
356279

357280
// STEP_START agg4
@@ -420,12 +343,6 @@ func ExampleClient_query_agg() {
420343
// __key=bicycle:7, discounted=387, price=430
421344
// __key=bicycle:8, discounted=1080, price=1200
422345
// 3
423-
// condition=new, num_affordable=3
424-
// condition=refurbished, num_affordable=1
425-
// condition=used, num_affordable=1
426-
// 1
427-
// type=bicycle, num_total=10
428-
// 3
429346
// condition=new, bicycles=[bicycle:0 bicycle:5 bicycle:6 bicycle:7 bicycle:8]
430347
// condition=refurbished, bicycles=[bicycle:9]
431348
// condition=used, bicycles=[bicycle:1 bicycle:2 bicycle:3 bicycle:4]

0 commit comments

Comments
 (0)