0

I'm wondering how to boost recent documents in Redisearch. There's no timestamp type for fields, but it's possible to make a numeric type like "day_of_creation" e.g. as number of days since 1970.

The question then is how to boost on such a field without updating the index, e.g. a modifier function like score = score * 1/(1 + day_of_query - document.day_of_creation). This means same-day documents retain their score, while day 2 documents have half the score, day 3 have one-third the score, etc.

I can see it might work via aggregators or a custom scoring function, but not entirely sure if either is able to do this.

mahemoff
  • 44,526
  • 36
  • 160
  • 222
  • 1
    Both can do it, aggregations will be slower but way easier. – Not_a_Golfer Aug 15 '19 at 14:06
  • Would you be able to show an example with aggregations? – mahemoff Aug 19 '19 at 17:02
  • @mhemoff man, it's been so long since I wrote the aggregation API :) I completely forgot the details, but the examples section I wrote in the documentation will give you an idea. However I think I didn't get to implementing an accessor to document score, so it might not work without a custom scoring function. However, offering a patch to add something like a `score()` function would proably be easier than writing a custom scorer. – Not_a_Golfer Aug 20 '19 at 15:15
  • (for context, I'm no longer working on the project, but try opening a ticket, this is something I wanted to do but didn't get to) – Not_a_Golfer Aug 20 '19 at 15:15
  • @Not_a_Golfer thanks, no worries, I'll add a ticket if no-one answers this, when I'm closer to working on it. – mahemoff Aug 20 '19 at 19:52

0 Answers0