File tree Expand file tree Collapse file tree 1 file changed +11
-5
lines changed
ydb/docs/ru/core/yql/reference/yql-core/udf/list Expand file tree Collapse file tree 1 file changed +11
-5
lines changed Original file line number Diff line number Diff 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)
179184WHERE user= " Williams"
180185ORDER BY Knn::CosineDistance(embedding, $TargetEmbedding)
181186LIMIT $K;
182187```
188+ {% endif %}
183189
184190### Точный поиск векторов, находящихся в радиусе R
185191
You can’t perform that action at this time.
0 commit comments