View Single Post
Old 01-22-2023, 05:55 AM   #485
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 12,476
Karma: 8025702
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by ownedbycats View Post
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
chaley is offline   Reply With Quote