Skip to content

Commit 035c6a0

Browse files
committed
DOC-5368: update VSIM command page for ROS8.2
1 parent a07a654 commit 035c6a0

File tree

1 file changed

+26
-11
lines changed

1 file changed

+26
-11
lines changed

content/commands/vsim.md

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,13 @@ complexity: O(log(N)) where N is the number of elements in the vector set.
1313
description: Return elements by vector similarity.
1414
group: vector_set
1515
hidden: false
16+
history:
17+
- - 8.2.0
18+
- added the WITHATTRIBS option.
1619
linkTitle: VSIM
1720
since: 8.0.0
1821
summary: Return elements by vector similarity.
19-
syntax_fmt: "VSIM key (ELE | FP32 | VALUES num) (vector | element) [WITHSCORES] [COUNT num] [EF search-exploration-factor]\n [FILTER expression] [FILTER-EF max-filtering-effort] [TRUTH] [NOTHREAD]"
22+
syntax_fmt: "VSIM key (ELE | FP32 | VALUES num) (vector | element) [WITHSCORES] [WITHATTRIBS] [COUNT num]\n [EF search-exploration-factor] [FILTER expression] [FILTER-EF max-filtering-effort] [TRUTH] [NOTHREAD]"
2023
title: VSIM
2124
bannerText: Vector set is a new data type that is currently in preview and may be subject to change.
2225
---
@@ -39,16 +42,19 @@ VSIM word_embeddings ELE apple
3942
10) "grape"
4043
```
4144

42-
You can include similarity scores and limit the number of results:
45+
You can include similarity scores, attributes (if any), and limit the number of results:
4346

4447
```shell
45-
VSIM word_embeddings ELE apple WITHSCORES COUNT 3
48+
VSIM word_embeddings ELE apple WITHSCORES WITHATTRIBS COUNT 3
4649
1) "apple"
4750
2) "0.9998867657923256"
48-
3) "apples"
49-
4) "0.8598527610301971"
50-
5) "pear"
51-
6) "0.8226882219314575"
51+
3) "{\"len\": 5}"
52+
4) "apples"
53+
5) "0.859852746129036"
54+
6) "{\"len\": 6}"
55+
7) "pear"
56+
8) "0.8226882070302963"
57+
9) "{\"len\": 4}"
5258
```
5359

5460
Set the `EF` (exploration factor) to improve recall at the cost of performance. Use the `TRUTH` option to perform an exact linear scan, useful for benchmarking. The `NOTHREAD` option runs the search in the main thread and may increase server latency.
@@ -81,6 +87,12 @@ is either the vector data (for `FP32` or `VALUES`) or the name of the element (f
8187
returns the similarity score (from 1 to 0) alongside each result. A score of 1 is identical; 0 is the opposite.
8288
</details>
8389

90+
<details open>
91+
<summary><code>WITHATTRIBS</code></summary>
92+
93+
returns, for each element, the JSON attribute associated with the element or NULL when no attributes are present.
94+
</details>
95+
8496
<details open>
8597
<summary><code>COUNT num</code></summary>
8698

@@ -128,16 +140,19 @@ executes the search in the main thread instead of a background thread. Useful fo
128140
tab2="RESP3" >}}
129141

130142
One of the following:
131-
* [Simple error reply](../../develop/reference/protocol-spec/#simple-errors) for unknown element.
132-
* [Array reply](../../develop/reference/protocol-spec#arrays) (empty array) for unknown key.
133-
* [Array reply](../../develop/reference/protocol-spec#arrays) with matching elements; juxtaposed with scores when used with the WITHSCORES option.
143+
* [Simple error reply](../../develop/reference/protocol-spec/#simple-errors) for an unknown element.
144+
* [Array reply](../../develop/reference/protocol-spec#arrays) (empty array) for an unknown key.
145+
* [Array reply](../../develop/reference/protocol-spec#arrays) with matching elements.
146+
* With the `WITHSCORES` option, an [array reply](../../develop/reference/protocol-spec#arrays) with matching [bulk string]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}}) elements juxtaposed with [bulk string]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}}) as floating-point scores.
147+
* With the `WITHCORES` and `WITHATTRIBS` options, an [array reply](../../develop/reference/protocol-spec#arrays) with matching [bulk string]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}}) elements, and two additional elements: (1) a [bulk string]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}}) as floating-point score and (2) a [bulk string]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}}) representing the JSON attribute associated with the element or [nil (null bulk string)]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}}) for the elements missing an attribute.
134148

135149
-tab-sep-
136150

137151
One of the following:
138152
* [Simple error reply](../../develop/reference/protocol-spec/#simple-errors) for unknown element.
139153
* [Array reply](../../develop/reference/protocol-spec#arrays) (empty array) for unknown key.
140154
* [Array reply](../../develop/reference/protocol-spec#arrays) with matching elements.
141-
* [Map reply](../../develop/reference/protocol-spec#maps) with matching elements and [double](../../develop/reference/protocol-spec#doubles) scores when used with the WITHSCORES option.
155+
* With the `WITHSCORES` option, a [map reply](../../develop/reference/protocol-spec#maps) with matching [bulk string]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}}) elements (keys) and [double](../../develop/reference/protocol-spec#doubles) scores (values).
156+
* With the `WITHSCORES` and `WITHATTRIBS` options, a [Map reply](../../develop/reference/protocol-spec#maps) with matching [bulk string]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}}) elements (keys), and an additional array (values) with the following elements: (1) a [double reply]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}}) for the score and (2) a [bulk string]({{< relref "/develop/reference/protocol-spec#bulk-strings" >}}) representing the JSON attribute associated with the element or [null]({{< relref "/develop/reference/protocol-spec#nulls" >}}) for the elements missing an attribute.
142157

143158
{{< /multitabs >}}

0 commit comments

Comments
 (0)