alphapapa / org-ql

A searching tool for Org-mode, including custom query languages, commands, saved searches and agenda-like views, etc.
GNU General Public License v3.0
1.41k stars 110 forks source link

Caching issues with relative time predicates #115

Open rychipman opened 4 years ago

rychipman commented 4 years ago

Time-based predicates in org-ql interact poorly with the built-in caching behavior. Consider the predicate '(scheduled :to today). If I open up emacs and run this query (in my personal workflow, via an org-ql-view), it works just fine. However, if that emacs instance stays open until tomorrow, the query results will be stale unless something else (an edit in an agenda file, for example) invalidates the cache).

My own workflow is only minimally affected by this at the moment, since I was primarily noticing this in one of my org-ql-views. So I replaced something like this

'("Scheduled up to today"
  :title "Scheduled up to today"
  :buffers-files org-agenda-files
  :query (scheduled :to today))

with something like this

(cons "Scheduled up to today"
      (lambda ()
        (interactive)
        (org-ql-search (org-agenda-files)
          `(scheduled :to ,(format-time-string "%Y-%m-%d"))
          :title "Scheduled up to today")))

However, this does seem like a more general problem.

Some thoughts/suggestions on how this could be resolved:

alphapapa commented 4 years ago

Thanks, that's a good point. Your second suggestion is probably the way to go.