#community-help

Vector Distance Sorting Request and Workaround

TLDR Herman asked about using vector_distance in sort_by to shuffle results. Kishore Nallan confirmed it's unavailable, but promised future support. Herman created a Github issue for tracking.

Powered by Struct AI
ty1
May 17, 2023 (4 months ago)
Herman
Photo of md5-e53e7941699c56dbd1ae40a3c06d5ea6
Herman
01:17 PM
Hi!

Quick question, is there any way to use the vector_distance on the sort_by?
I was trying to shuffle a little bit the results so similar items are not so close to each other
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
01:24 PM
We don't have a way to do this. But this is a very useful ask. We will add support for it.
01:24
Kishore Nallan
01:24 PM
The results are already sorted by vector distance from the query vector.
01:25
Kishore Nallan
01:25 PM
But no way to refer to this score in the sort_by clause yet.
Herman
Photo of md5-e53e7941699c56dbd1ae40a3c06d5ea6
Herman
01:31 PM
Thanks for your reply!
From what I could see on Github, release are made every 2-3 month, so I will look for a client side workaround in the mean time
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
02:18 PM
We do publish RC builds often though. Can you please create a Github issue for tracking. I will update status on that as well.
Herman
Photo of md5-e53e7941699c56dbd1ae40a3c06d5ea6
Herman
03:10 PM
Done: https://github.com/typesense/typesense/issues/1022
let me know if there is any missing info or comment
ty1