2

I use RedisSearch to query my products

I want to get last 10 products changed

In SQL I can do that with:

Select top 10 * from products order by max(changedate) desc

How can I get the same result using RedisSearch?

Guy Korland
  • 9,139
  • 14
  • 59
  • 106
Akelmj
  • 99
  • 4
  • *"In SQL I can do that with:"* In SQL [Server] That statement would error... (Unless the table only has the column `changedate`, which I doubt.) – Thom A Sep 05 '22 at 16:02

1 Answers1

0

You can use a range query with sortby.

FT.SEARCH products "@changedate:[somedate inf]" SORTBY changedate DESC

Please note that the smaller the date range you give, the faster the query will execute. You can fo [-inf inf] but that will not be efficiant.

Ariel
  • 529
  • 2
  • 13