     (db-common/with-timeout db-common/default-timeout
       (as-> (r/table table-name) query
         (r/get-all query index-value {:index index-name})
-           ;; Merge in last-activity-at, last-seen-at and sort-value
         (r/merge query (r/fn [post-row]
           {;; The real value used for the sort
            :sort-value (r-millis (r/get-field post-row :published-at))}))

    (db-common/with-timeout db-common/default-timeout
      (as-> (r/table table-name) query
        (r/get-all query index-value {:index index-name})
           ;; Merge in last-activity-at, last-seen-at and sort-value
        (r/merge query (r/fn [post-row]
           (let [sort-field (r/default (r/get-field post-row :published-at)
                                       (r/get-field post-row :created-at))

    (db-common/with-timeout db-common/default-timeout
      (as-> (r/table table-name) query
        (r/get-all query index-value {:index index-name})
        (r/merge query (r/fn [post-row]
          (let [sort-field (-> (r/get-field post-row [:bookmarks])
                              (r/filter {:user-id user-id})
