How to use document age as weigt in ts_rank In a search mode I would like to impact the rank of my search related to age of the document. I have a working version but I found it very complicated.

It say "Does the same founded younger document is more relevant than an older one"?

SELECT 
  ts_rank(to_tsvector('an example of document'), to_tsquery('document')) / 
    (EXTRACT(epoch FROM (SELECT (NOW() - INTERVAL '3 days')))/3600)::int &gt; 
  ts_rank(to_tsvector('example of document'), to_tsquery('document')) / 
    (EXTRACT(epoch FROM (SELECT (NOW() - INTERVAL '10 days')))/3600)::int AS relevancy;


How to deal with more precise time without having "complex" result like:

SELECT ts_rank(to_tsvector('example of document'), to_tsquery('document')) / 
    (EXTRACT(epoch FROM (SELECT (NOW() - INTERVAL '10 days')))/3600)::int; -- 1.4441788961179666e-07


Should I round for performance?
I don't even get how this code is supposed to work

You have

(EXTRACT(epoch FROM (SELECT (NOW() - INTERVAL '10 days')))/3600)::int


All that's doing is resolving to a static int. How is dividing a result set by a static int significant.

SELECT ts_rank(to_tsvector('example of document'), to_tsquery('document'))
  / 420953;