In Postgres, you can add or subtract an interval to or from a timestamp to produce another timestamp, as described here.
So in this case, assuming time_of_search
is a timestamp, you could do
"SELECT MAX(time_of_search) - INTERVAL '1 hour' FROM listings WHERE id=#{id}"