()
| 10 | ) |
| 11 | |
| 12 | func ExampleClient_query_range() { |
| 13 | ctx := context.Background() |
| 14 | |
| 15 | rdb := redis.NewClient(&redis.Options{ |
| 16 | Addr: "localhost:6379", |
| 17 | Password: "", // no password docs |
| 18 | DB: 0, // use default DB |
| 19 | Protocol: 2, |
| 20 | }) |
| 21 | |
| 22 | // HIDE_END |
| 23 | // REMOVE_START |
| 24 | rdb.FTDropIndex(ctx, "idx:bicycle") |
| 25 | rdb.FTDropIndex(ctx, "idx:email") |
| 26 | // REMOVE_END |
| 27 | |
| 28 | _, err := rdb.FTCreate(ctx, "idx:bicycle", |
| 29 | &redis.FTCreateOptions{ |
| 30 | OnJSON: true, |
| 31 | Prefix: []interface{}{"bicycle:"}, |
| 32 | }, |
| 33 | &redis.FieldSchema{ |
| 34 | FieldName: "$.brand", |
| 35 | As: "brand", |
| 36 | FieldType: redis.SearchFieldTypeText, |
| 37 | }, |
| 38 | &redis.FieldSchema{ |
| 39 | FieldName: "$.model", |
| 40 | As: "model", |
| 41 | FieldType: redis.SearchFieldTypeText, |
| 42 | }, |
| 43 | &redis.FieldSchema{ |
| 44 | FieldName: "$.description", |
| 45 | As: "description", |
| 46 | FieldType: redis.SearchFieldTypeText, |
| 47 | }, |
| 48 | &redis.FieldSchema{ |
| 49 | FieldName: "$.price", |
| 50 | As: "price", |
| 51 | FieldType: redis.SearchFieldTypeNumeric, |
| 52 | }, |
| 53 | &redis.FieldSchema{ |
| 54 | FieldName: "$.condition", |
| 55 | As: "condition", |
| 56 | FieldType: redis.SearchFieldTypeTag, |
| 57 | }, |
| 58 | ).Result() |
| 59 | |
| 60 | if err != nil { |
| 61 | panic(err) |
| 62 | } |
| 63 | |
| 64 | exampleJsons := []map[string]interface{}{ |
| 65 | { |
| 66 | "pickup_zone": "POLYGON((-74.0610 40.7578, -73.9510 40.7578, -73.9510 40.6678, " + |
| 67 | "-74.0610 40.6678, -74.0610 40.7578))", |
| 68 | "store_location": "-74.0060,40.7128", |
| 69 | "brand": "Velorim", |
nothing calls this directly
no test coverage detected