Skip to content

Commit 90a09a9

Browse files
authored
fix
1 parent 3987e55 commit 90a09a9

File tree

1 file changed

+11
-5
lines changed
  • ydb/docs/ru/core/yql/reference/yql-core/udf/list

1 file changed

+11
-5
lines changed

ydb/docs/ru/core/yql/reference/yql-core/udf/list/knn.md

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -165,21 +165,27 @@ $facts = AsList(
165165

166166
### Точный поиск K ближайших векторов
167167

168+
{% if backend_name == "YDB" %}
168169
```sql
169170
$K = 10;
170171
$TargetEmbedding = Knn::ToBinaryStringFloat([1.2f, 2.3f, 3.4f, 4.5f]);
171172

172-
SELECT *
173-
{% if backend_name == "YDB" %}
174-
FROM Facts
173+
SELECT * FROM Facts
174+
WHERE user="Williams"
175+
ORDER BY Knn::CosineDistance(embedding, $TargetEmbedding)
176+
LIMIT $K;
177+
```
175178
{% else %}
176-
FROM AS_TABLE($facts)
177-
{% endif %}
179+
```sql
180+
$K = 10;
181+
$TargetEmbedding = Knn::ToBinaryStringFloat([1.2f, 2.3f, 3.4f, 4.5f]);
178182

183+
SELECT * FROM AS_TABLE($facts)
179184
WHERE user="Williams"
180185
ORDER BY Knn::CosineDistance(embedding, $TargetEmbedding)
181186
LIMIT $K;
182187
```
188+
{% endif %}
183189

184190
### Точный поиск векторов, находящихся в радиусе R
185191

0 commit comments

Comments
 (0)