Newbie here. I am trying to come up with a query to put on my right-side bar that list the last N (e.g. 10 or 20) recently accessed pages, ideally ordered by recency (mst recent first) and paginated (showing 5 at a time).
(The Recent Pages on the Left menu does not help in my use case, I need this on the right-side bar)
My 3-day logseq experience and null datalog experience is not helping me on this.
I found this: List of recently created/modified pages (timestamp issues)
but that approach is based on limiting the timeframe (e.g. pages created in the last X days) which is not what I need. I need the last N pages opened regardless of their access timestamp.
I couldn’t even extract the top-N results from the timestamp-based example above, the below doesn’t work
#+BEGIN_QUERY
{:title [:h3 "Recent Pages"]
:query [:find (pull ?b [* {:block/_parent ...}])
:in $ ?end
:where
[?b :block/updated-at ?v]
[(- ?end 86400000 ) ?period]
[(>= ?v ?period)]
[(< ?v ?end)]
]
:inputs [:end-of-today-ms]
:result-transform (fn [result] ( ->> result (take(10))))
}
#+END_QUERY