Skip to content

Commit 9f6cc44

Browse files
Merge pull request #1389 from redis/DOC-5073-add-vec-set-tces
DOC-5073 added TCE markup
2 parents 36bdb4a + c029c70 commit 9f6cc44

File tree

1 file changed

+17
-16
lines changed
  • content/develop/data-types/vector-sets

1 file changed

+17
-16
lines changed

content/develop/data-types/vector-sets/_index.md

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ Start by adding the point vectors to a set called `points` using
6060
The [`TYPE`]({{< relref "/commands/type" >}}) command returns a type of `vectorset`
6161
for this object.
6262

63-
```
63+
{{< clients-example vecset_tutorial vadd >}}
6464
> VADD points VALUES 2 1.0 1.0 pt:A
6565
(integer) 1
6666
> VADD points VALUES 2 -1.0 -1.0 pt:B
@@ -73,26 +73,27 @@ for this object.
7373
(integer) 1
7474
> TYPE points
7575
vectorset
76-
```
76+
{{< /clients-example >}}
77+
7778

7879
Get the number of elements in the set (also known as the *cardinality* of the set)
7980
using [`VCARD`]({{< relref "/commands/vcard" >}}) and the number of dimensions of
8081
the vectors using [`VDIM`]({{< relref "/commands/vdim" >}}):
8182

82-
```
83+
{{< clients-example vecset_tutorial vcardvdim >}}
8384
> VCARD points
8485
(integer) 5
8586
> VDIM points
8687
(integer) 2
87-
```
88+
{{< /clients-example >}}
8889

8990
Get the coordinate values from the elements using [`VEMB`]({{< relref "/commands/vemb" >}}).
9091
Note that the values will not typically be the exact values you supplied when you added
9192
the vector because
9293
[quantization]({{< relref "/develop/data-types/vector-sets/performance#quantization-effects" >}})
9394
is applied to improve performance.
9495

95-
```
96+
{{< clients-example vecset_tutorial vemb >}}
9697
> VEMB points pt:A
9798
1) "0.9999999403953552"
9899
2) "0.9999999403953552"
@@ -108,14 +109,14 @@ is applied to improve performance.
108109
> VEMB points pt:E
109110
1) "1"
110111
2) "0"
111-
```
112+
{{< /clients-example >}}
112113

113114
Set and retrieve an element's JSON attribute data using
114115
[`VSETATTR`]({{< relref "/commands/vsetattr" >}})
115116
and [`VGETATTR`]({{< relref "/commands/vgetattr" >}}). You can also pass an empty string
116117
to `VSETATTR` to delete the attribute data:
117118

118-
```
119+
{{< clients-example vecset_tutorial attr >}}
119120
> VSETATTR points pt:A "{\"name\": \"Point A\", \"description\": \"First point added\"}"
120121
(integer) 1
121122
> VGETATTR points pt:A
@@ -124,11 +125,11 @@ to `VSETATTR` to delete the attribute data:
124125
(integer) 1
125126
> VGETATTR points pt:A
126127
(nil)
127-
```
128+
{{< /clients-example >}}
128129

129130
Remove an unwanted element with [`VREM`]({{< relref "/commands/vrem" >}})
130131

131-
```
132+
{{< clients-example vecset_tutorial vrem >}}
132133
> VADD points VALUES 2 0 0 pt:F
133134
(integer) 1
134135
127.0.0.1:6379> VCARD points
@@ -137,24 +138,24 @@ Remove an unwanted element with [`VREM`]({{< relref "/commands/vrem" >}})
137138
(integer) 1
138139
127.0.0.1:6379> VCARD points
139140
(integer) 5
140-
```
141+
{{< /clients-example >}}
141142

142143
### Vector similarity search
143144

144145
Use [`VSIM`]({{< relref "/commands/vsim" >}}) to rank the points in order of their vector distance from a sample point:
145146

146-
```
147+
{{< clients-example vecset_tutorial vsim_basic >}}
147148
> VSIM points values 2 0.9 0.1
148149
1) "pt:E"
149150
2) "pt:A"
150151
3) "pt:D"
151152
4) "pt:C"
152153
5) "pt:B"
153-
```
154+
{{< /clients-example >}}
154155

155156
Find the four elements that are closest to point A and show their distance "scores":
156157

157-
```
158+
{{< clients-example vecset_tutorial vsim_options >}}
158159
> VSIM points ELE pt:A WITHSCORES COUNT 4
159160
1) "pt:A"
160161
2) "1"
@@ -164,13 +165,13 @@ Find the four elements that are closest to point A and show their distance "scor
164165
6) "0.5"
165166
7) "pt:D"
166167
8) "0.5"
167-
```
168+
{{< /clients-example >}}
168169

169170
Add some JSON attributes and use
170171
[filter expressions]({{< relref "/develop/data-types/vector-sets/filtered-search" >}})
171172
to include them in the search:
172173

173-
```
174+
{{< clients-example vecset_tutorial vsim_filter >}}
174175
> VSETATTR points pt:A "{\"size\":\"large\",\"price\": 18.99}"
175176
(integer) 1
176177
> VSETATTR points pt:B "{\"size\":\"large\",\"price\": 35.99}"
@@ -194,7 +195,7 @@ to include them in the search:
194195
> VSIM points ELE pt:A FILTER '.size == "large" && .price > 20.00'
195196
1) "pt:C"
196197
2) "pt:B"
197-
```
198+
{{< /clients-example >}}
198199

199200
## More information
200201

0 commit comments

Comments
 (0)