@@ -60,7 +60,7 @@ Start by adding the point vectors to a set called `points` using
6060The [ ` TYPE ` ] ({{< relref "/commands/type" >}}) command returns a type of ` vectorset `
6161for 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
7879Get the number of elements in the set (also known as the * cardinality* of the set)
7980using [ ` VCARD ` ] ({{< relref "/commands/vcard" >}}) and the number of dimensions of
8081the 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
8990Get the coordinate values from the elements using [ ` VEMB ` ] ({{< relref "/commands/vemb" >}}).
9091Note that the values will not typically be the exact values you supplied when you added
9192the vector because
9293[ quantization] ({{< relref "/develop/data-types/vector-sets/performance#quantization-effects" >}})
9394is applied to improve performance.
9495
95- ```
96+ {{< clients-example vecset_tutorial vemb >}}
9697> VEMB points pt: A
97981 ) "0.9999999403953552"
98992 ) "0.9999999403953552"
@@ -108,14 +109,14 @@ is applied to improve performance.
108109> VEMB points pt: E
1091101 ) "1"
1101112 ) "0"
111- ```
112+ {{< /clients-example >}}
112113
113114Set and retrieve an element's JSON attribute data using
114115[ ` VSETATTR ` ] ({{< relref "/commands/vsetattr" >}})
115116and [ ` VGETATTR ` ] ({{< relref "/commands/vgetattr" >}}). You can also pass an empty string
116117to ` 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
129130Remove 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
134135127.0.0.1:6379> VCARD points
@@ -137,24 +138,24 @@ Remove an unwanted element with [`VREM`]({{< relref "/commands/vrem" >}})
137138(integer) 1
138139127.0.0.1:6379> VCARD points
139140(integer) 5
140- ```
141+ {{< /clients-example >}}
141142
142143### Vector similarity search
143144
144145Use [ ` 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
1481491 ) "pt: E "
1491502 ) "pt: A "
1501513 ) "pt: D "
1511524 ) "pt: C "
1521535 ) "pt: B "
153- ```
154+ {{< /clients-example >}}
154155
155156Find 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
1591601 ) "pt: A "
1601612 ) "1"
@@ -164,13 +165,13 @@ Find the four elements that are closest to point A and show their distance "scor
1641656 ) "0.5"
1651667 ) "pt: D "
1661678 ) "0.5"
167- ```
168+ {{< /clients-example >}}
168169
169170Add some JSON attributes and use
170171[ filter expressions] ({{< relref "/develop/data-types/vector-sets/filtered-search" >}})
171172to 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'
1951961 ) "pt: C "
1961972 ) "pt: B "
197- ```
198+ {{< /clients-example >}}
198199
199200## More information
200201
0 commit comments