File tree 1 file changed +28
-0
lines changed
1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -152,6 +152,32 @@ func ExampleClient_search_json() {
152
152
// >>> Tel Aviv
153
153
// STEP_END
154
154
155
+ // STEP_START query2count_only
156
+ citiesResult2 , err := rdb .FTSearchWithArgs (
157
+ ctx ,
158
+ "idx:users" ,
159
+ "Paul" ,
160
+ & redis.FTSearchOptions {
161
+ Return : []redis.FTSearchReturn {
162
+ {
163
+ FieldName : "$.city" ,
164
+ As : "city" ,
165
+ },
166
+ },
167
+ CountOnly : true ,
168
+ },
169
+ ).Result ()
170
+
171
+ if err != nil {
172
+ panic (err )
173
+ }
174
+
175
+ // The `Total` field has the correct number of docs found
176
+ // by the query but the `Docs` slice is empty.
177
+ fmt .Println (len (citiesResult2 .Docs )) // >>> 0
178
+ fmt .Println (citiesResult2 .Total ) // >>> 2
179
+ // STEP_END
180
+
155
181
// STEP_START query3
156
182
aggOptions := redis.FTAggregateOptions {
157
183
GroupBy : []redis.FTAggregateGroupBy {
@@ -196,6 +222,8 @@ func ExampleClient_search_json() {
196
222
// {1 [{user:3 <nil> <nil> <nil> map[$:{"age":35,"city":"Tel Aviv","email":"[email protected] ","name":"Paul Zamir"}]}]}
197
223
// London
198
224
// Tel Aviv
225
+ // 0
226
+ // 2
199
227
// London - 1
200
228
// Tel Aviv - 2
201
229
}
You can’t perform that action at this time.
0 commit comments