Fix: Cache invalidation of relative-date ts-related predicates

Fixes #223.  Thanks to Ihor Radchenko (@yantar92) for reporting.
This commit is contained in:
Adam Porter 2021-06-21 06:18:03 -05:00
parent 87b3d0bd97
commit 482a5c939b
5 changed files with 557 additions and 146 deletions

View file

@ -543,8 +543,8 @@ These predicates take optional keyword arguments:
Timestamp/date arguments should be either a number of days (positive
to look forward, or negative to look backward), a string parseable by
parse-time-string (the string may omit the time value), or a ts
struct.
parse-time-string (the string may omit the time value), the symbol
today, or a ts struct.
• *Predicates*
ts
@ -560,6 +560,10 @@ struct.
also take a single argument, a number, which looks backward or forward a
number of days. The number can be negative to invert the direction.
These two predicates interpret a single number argument as if it were
passed to the :from keyword argument, which eases the common case of
searching for items clocked or closed in the past few days:
• *Backward-looking*
clocked
Return non-nil if current entry was clocked in given period.
@ -571,6 +575,10 @@ number of days. The number can be negative to invert the direction.
Return non-nil if current entry was closed in given period.
Without arguments, return non-nil if entry is closed.
These predicates interpret a single number argument as if it were
passed to the :to keyword argument, which eases the common case of
searching for items planned in the next few days:
• *Forward-looking*
deadline
Return non-nil if current entry has deadline in given period.
@ -815,7 +823,9 @@ File: README.info, Node: Custom predicates, Prev: Listing / acting-on results,
forms. For example, when the predicate has aliases, the aliases
should be replaced with predicate names using a normalizer. Also,
predicate arguments may be put into a more optimal form so that the
predicate has less work to do at query time.
predicate has less work to do at query time. NOTE: Normalizers are
applied to a query repeatedly until the query is fully normalized,
so normalizers should be carefully written to avoid infinite loops.
PREAMBLES refer to regular expressions which may be used to
search through a buffer directly to a potential match rather than
@ -1002,12 +1012,23 @@ File: README.info, Node: 06-pre, Next: 052, Up: Changelog
(https://github.com/jmay), and Basil L. Contovounesios
(https://github.com/basil-conto).)
*Fixed*
• Timestamp-related predicates called with relative-date arguments
did not properly invalidate the query cache. (Fixes #223
(https://github.com/alphapapa/org-ql/issues/223). Thanks to Ihor
Radchenko (https://github.com/yantar92) for reporting.)
*Internal*
• Predicates are now defined more cleanly with a macro
(org-ql-defpred) that consolidates functionality related to each
predicate. This will also allow users to more easily define custom
predicates.
• Version 1.0 of library peg is now required.
• Improvements to how arguments to timestamp-related predicates are
processed.
• Predicate normalizers are now applied repeatedly until a query is
fully normalized. (Normalizers should be written with this in mind
to avoid infinite loops.)

File: README.info, Node: 052, Next: 051, Prev: 06-pre, Up: Changelog
@ -1538,40 +1559,40 @@ Node: Non-sexp query syntax9485
Node: General predicates11209
Node: Ancestor/descendant predicates17430
Node: Date/time predicates18558
Node: Functions / Macros21220
Node: Agenda-like views21518
Node: Listing / acting-on results22923
Node: Custom predicates28545
Node: Dynamic block32036
Node: Links34734
Node: Tips35421
Node: Changelog35739
Node: 06-pre36465
Node: 05238038
Node: 05138342
Node: 0538759
Node: 04940233
Node: 04840507
Node: 04740854
Node: 04641249
Node: 04541649
Node: 04442008
Node: 04342367
Node: 04242564
Node: 04142725
Node: 0442966
Node: 03246899
Node: 03147278
Node: 0347475
Node: 02350450
Node: 02250678
Node: 02150946
Node: 0251145
Node: 0155180
Node: Notes55281
Node: Comparison with Org Agenda searches55443
Node: org-sidebar56315
Node: License56594
Node: Functions / Macros21646
Node: Agenda-like views21944
Node: Listing / acting-on results23349
Node: Custom predicates28971
Node: Dynamic block32630
Node: Links35328
Node: Tips36015
Node: Changelog36333
Node: 06-pre37059
Node: 05239177
Node: 05139481
Node: 0539898
Node: 04941372
Node: 04841646
Node: 04741993
Node: 04642388
Node: 04542788
Node: 04443147
Node: 04343506
Node: 04243703
Node: 04143864
Node: 0444105
Node: 03248038
Node: 03148417
Node: 0348614
Node: 02351589
Node: 02251817
Node: 02152085
Node: 0252284
Node: 0156319
Node: Notes56420
Node: Comparison with Org Agenda searches56582
Node: org-sidebar57454
Node: License57733

End Tag Table