Is it possible to sort vectors?

I am using different date fields (like “created_at” and “updated_at”) in metadata. Can I sort the top n vectors that I want to pull out by date?


There is no built-in functionality to sort the metadata. (To the best of my knowledge)

What you can do:

  1. Retrieve data within a specific date range, such as from 2023-06-18 to 2023-06-21.
  2. Retrieve the top n data based on their scores.

What you cannot do:

  1. Retrieve n data sorted in ascending (or descending) order within a specific date range, such as from 2023-06-18 to 2023-06-21.

Could you please provide more details about the use case where this functionality is needed? It would help me understand if there are alternative approaches or workarounds.

1 Like

Hi Dra,
Yeah that was I thought.

To describe my use case a bit : my data will change with time, for example I got a vector that say something like “I am a tennis pro player with 6 years of experience”. This will not work next year since it will be 7 years of experience.

Generally speaking, when there is a text expressed in a timely manner, and that this text is not present every year, I cannot filter by range, or I will loose data.

For the tennis example, let’s say the player stop doing tennis, so he will forever have 6 years of experience. But I filter on the date, I may loose the 6 years of experience when it will not be in range.

My real production data don’t have a 1 year turn over, more like 4-6 months, so it is even more impactful.
Since I am working with data old of 1-2 years, this is a current issue I am having :thinking:.

Hi louis,

First off, I totally get the pickle you’re in. It’s like playing a tennis match but the scoreboard never updates, right? So, let’s bounce some ideas around.

One approach might be a bit of a twist on the way you phrase things. If you say “I’m a pro tennis player with 6 years of experience”, that info’s going to get old as time passes. So, how about saying something like, “I’ve been a pro tennis player since 2017”? That way, you can automatically calculate how much experience you have, and your info will always be up-to-date.

Another idea is to split the profile and experience information into separate vectors. For example, in the ‘Profile’ vector, you could store the player’s basic information and the year they started playing tennis, and in the ‘Experience’ vector, you could keep track of their years of experience and past match results. With this setup, even if the number of years of experience increases, it won’t affect the profile vector, and even if new match results are added, the existing profile info stays intact.

I hope these ideas will serve you well in tackling your problem. While they might not be a perfect solution, hopefully they can give you a nudge in the right direction.