Skip to content

Commit 795f398

Browse files
authored
DEV: add TCEs to query > exact match page (#644)
1 parent e369166 commit 795f398

File tree

1 file changed

+61
-25
lines changed

1 file changed

+61
-25
lines changed

content/develop/interact/search-and-query/query/exact-match.md

Lines changed: 61 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -53,21 +53,31 @@ FT.SEARCH index "*" FILTER field start end
5353

5454
The following examples show you how to query for bicycles with a price of exactly 270 USD:
5555

56-
```
57-
FT.SEARCH idx:bicycle "@price:[270 270]"
58-
```
59-
60-
```
61-
FT.SEARCH idx:bicycle "@price:[270]" # requires v2.10
62-
```
63-
64-
```
65-
FT.SEARCH idx:bicycle "@price==270" # requires v2.10
66-
```
67-
68-
```
69-
FT.SEARCH idx:bicycle "*" FILTER price 270 270
70-
```
56+
{{< clients-example query_em em1 >}}
57+
> FT.SEARCH idx:bicycle "@price:[270 270]"
58+
1) (integer) 1
59+
2) "bicycle:0"
60+
3) 1) "$"
61+
2) "{\"pickup_zone\":\"POLYGON((-74.0610 40.7578, ...
62+
63+
> FT.SEARCH idx:bicycle "@price:[270]" # requires v2.10
64+
1) (integer) 1
65+
2) "bicycle:0"
66+
3) 1) "$"
67+
2) "{\"pickup_zone\":\"POLYGON((-74.0610 40.7578, ...
68+
69+
> FT.SEARCH idx:bicycle "@price==270" # requires v2.10
70+
1) (integer) 1
71+
2) "bicycle:0"
72+
3) 1) "$"
73+
2) "{\"pickup_zone\":\"POLYGON((-74.0610 40.7578, ...
74+
75+
> FT.SEARCH idx:bicycle "*" FILTER price 270 270
76+
1) (integer) 1
77+
2) "bicycle:0"
78+
3) 1) "$"
79+
2) "{\"pickup_zone\":\"POLYGON((-74.0610 40.7578, ...
80+
{{< /clients-example >}}
7181

7282

7383
## Tag field
@@ -90,17 +100,39 @@ The curly brackets are mandatory for tag queries.
90100

91101
This short example shows you how to query for new bicycles:
92102

93-
```
94-
FT.SEARCH idx:bicycle "@condition:{new}"
95-
```
103+
{{< clients-example query_em em2 >}}
104+
> FT.SEARCH idx:bicycle "@condition:{new}"
105+
1) (integer) 5
106+
2) "bicycle:0"
107+
3) 1) "$"
108+
2) "{\"pickup_zone\":\"POLYGON((-74.0610 40.7578, -73.9510 40.7578, -73.9510 40.6678, -74.0610 40.6678, -74.0610 40.7578))\",\"store_location\":\"-74.0060,40.7128\",\"brand\":\"Velorim\",\"model\":\"Jigger\",\"price\":270,\"description\":\"Small and powerful, the Jigger is the best ride for the smallest of tikes! This is the tiniest kids\xe2\x80\x99 pedal bike on the market available without a coaster brake, the Jigger is the vehicle of choice for the rare tenacious little rider raring to go.\",\"condition\":\"new\"}"
109+
4) "bicycle:5"
110+
5) 1) "$"
111+
2) "{\"pickup_zone\":\"POLYGON((-0.1778 51.5524, 0.0822 51.5524, 0.0822 51.4024, -0.1778 51.4024, -0.1778 51.5524))\",\"store_location\":\"-0.1278,51.5074\",\"brand\":\"Breakout\",\"model\":\"XBN 2.1 Alloy\",\"price\":810,\"description\":\"The XBN 2.1 Alloy is our entry-level road bike \xe2\x80\x93 but that\xe2\x80\x99s not to say that it\xe2\x80\x99s a basic machine. With an internal weld aluminium frame, a full carbon fork, and the slick-shifting Claris gears from Shimano\xe2\x80\x99s, this is a bike which doesn\xe2\x80\x99t break the bank and delivers craved performance.\",\"condition\":\"new\"}"
112+
6) "bicycle:6"
113+
7) 1) "$"
114+
2) "{\"pickup_zone\":\"POLYGON((2.1767 48.9016, 2.5267 48.9016, 2.5267 48.5516, 2.1767 48.5516, 2.1767 48.9016))\",\"store_location\":\"2.3522,48.8566\",\"brand\":\"ScramBikes\",\"model\":\"WattBike\",\"price\":2300,\"description\":\"The WattBike is the best e-bike for people who still feel young at heart. It has a Bafang 1000W mid-drive system and a 48V 17.5AH Samsung Lithium-Ion battery, allowing you to ride for more than 60 miles on one charge. It\xe2\x80\x99s great for tackling hilly terrain or if you just fancy a more leisurely ride. With three working modes, you can choose between E-bike, assisted bicycle, and normal bike modes.\",\"condition\":\"new\"}"
115+
8) "bicycle:7"
116+
9) 1) "$"
117+
2) "{\"pickup_zone\":\"POLYGON((13.3260 52.5700, 13.6550 52.5700, 13.6550 52.2700, 13.3260 52.2700, 13.3260 52.5700))\",\"store_location\":\"13.4050,52.5200\",\"brand\":\"Peaknetic\",\"model\":\"Secto\",\"price\":430,\"description\":\"If you struggle with stiff fingers or a kinked neck or back after a few minutes on the road, this lightweight, aluminum bike alleviates those issues and allows you to enjoy the ride. From the ergonomic grips to the lumbar-supporting seat position, the Roll Low-Entry offers incredible comfort. The rear-inclined seat tube facilitates stability by allowing you to put a foot on the ground to balance at a stop, and the low step-over frame makes it accessible for all ability and mobility levels. The saddle is very soft, with a wide back to support your hip joints and a cutout in the center to redistribute that pressure. Rim brakes deliver satisfactory braking control, and the wide tires provide a smooth, stable ride on paved roads and gravel. Rack and fender mounts facilitate setting up the Roll Low-Entry as your preferred commuter, and the BMX-like handlebar offers space for mounting a flashlight, bell, or phone holder.\",\"condition\":\"new\"}"
118+
10) "bicycle:8"
119+
11) 1) "$"
120+
2) "{\"pickup_zone\":\"POLYGON((1.9450 41.4301, 2.4018 41.4301, 2.4018 41.1987, 1.9450 41.1987, 1.9450 41.4301))\",\"store_location\":\"2.1734, 41.3851\",\"brand\":\"nHill\",\"model\":\"Summit\",\"price\":1200,\"description\":\"This budget mountain bike from nHill performs well both on bike paths and on the trail. The fork with 100mm of travel absorbs rough terrain. Fat Kenda Booster tires give you grip in corners and on wet trails. The Shimano Tourney drivetrain offered enough gears for finding a comfortable pace to ride uphill, and the Tektro hydraulic disc brakes break smoothly. Whether you want an affordable bike that you can take to work, but also take trail in mountains on the weekends or you\xe2\x80\x99re just after a stable, comfortable ride for the bike path, the Summit gives a good value for money.\",\"condition\":\"new\"}"
121+
{{< /clients-example >}}
96122

97123
Use double quotes and [DIALECT 2]({{< relref "/develop/interact/search-and-query/advanced-concepts/dialects" >}}#dialect-2) for exact match queries involving tags that contain special characters. As of v2.10, the only character that needs escaping in queries involving double-quoted tags is the double-quote character. Here's an example of using double-quoted tags that contain special characters:
98-
```
99-
JSON.SET key:1 $ '{"email": "test@redis.com"}'
100-
FT.CREATE idx ON JSON PREFIX 1 key: SCHEMA $.email AS email TAG
101124

102-
FT.SEARCH idx '@email:{"test@redis.com"}' DIALECT 2
103-
```
125+
{{< clients-example query_em em3 >}}
126+
> FT.CREATE idx:email ON JSON PREFIX 1 key: SCHEMA $.email AS email TAG
127+
OK
128+
> JSON.SET key:1 $ '{"email": "test@redis.com"}'
129+
OK
130+
> FT.SEARCH idx:email '@email:{"test@redis.com"}' DIALECT 2
131+
1) (integer) 1
132+
2) "key:1"
133+
3) 1) "$"
134+
2) "{\"email\":\"test@redis.com\"}"
135+
{{< /clients-example>}}
104136

105137
## Full-text field
106138

@@ -118,6 +150,10 @@ You can't use a phrase that starts with a [stop word]({{< relref "/develop/inter
118150

119151
Here is an example for finding all bicycles that have a description containing the exact text 'rough terrain':
120152

121-
```
153+
{{< clients-example query_em em4 >}}
122154
FT.SEARCH idx:bicycle "@description:\"rough terrain\""
123-
```
155+
1) (integer) 1
156+
2) "bicycle:8"
157+
3) 1) "$"
158+
2) "{\"pickup_zone\":\"POLYGON((1.9450 41.4301, 2.4018 41.4301, 2.4018 41.1987, 1.9450 41.1987, 1.9450 41.4301))\",\"store_location\":\"2.1734, 41.3851\",\"brand\":\"nHill\",\"model\":\"Summit\",\"price\":1200,\"description\":\"This budget mountain bike from nHill performs well both on bike paths and on the trail. The fork with 100mm of travel absorbs rough terrain. Fat Kenda Booster tires give you grip in corners and on wet trails. The Shimano Tourney drivetrain offered enough gears for finding a comfortable pace to ride uphill, and the Tektro hydraulic disc brakes break smoothly. Whether you want an affordable bike that you can take to work, but also take trail in mountains on the weekends or you\xe2\x80\x99re just after a stable, comfortable ride for the bike path, the Summit gives a good value for money.\",\"condition\":\"new\"}"
159+
{{< /clients-example >}}

0 commit comments

Comments
 (0)