Quote:
Originally Posted by ownedbycats
Additionally, something I forgot: logical-and is '&&.' What is a logical-or?
EDIT: Found it in the reference. ||
ANOTHER EDIT: In the Calibre search, it's possible to do something like this to find matches in both groups:
(title:foo AND author:bar) OR (title:bar AND author:bar)
if possible, how would the same thing be done in a template?
|
In an "if" in a template? More or less as you wrote it.
Code:
('foo' in $title && 'bar' in $author) || ('bar' in $title && 'bar' in $author)
Note that the expression can be simplified in both cases, removing the duplicate author check.
Code:
('foo' in $title || 'bar' in $title) && 'bar' in $author
Code:
(title:foo OR title:bar) AND author:bar
They both can be further simplified using regular expressions.
Code:
'foo|bar' in $title && 'bar' in $author
Code:
title:~foo|bar AND author:bar