View Single Post
Old 01-03-2022, 07:00 AM   #6
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
To add some detail: when virtual_libraries() is used in a VL search expression the computation required is "To compute the books in this virtual library I must know what books are in this virtual library." This is a recursive question and is not computable. Instead of having calibre roll over dead I made the choice to answer "The books are in no VL."

Usually the "No books" answer doesn't hurt anything. Virtual libraries are really just searches. There are cases where a search must evaluate all composite columns (unprefixed search terms with no search field limits). If a composite column uses virtual_libraries() we have a recursive search. However, if the composite column value isn't used in the search then no harm is done and the search returns the correct value.

However, your case shows that the "No books" answer isn't optimal when a VL really is misconfigured. To fix this I submitted a change that raises an error instead of returning "No books". The error will usually be displayed by the composite if it had to recurse. The change doesn't (seem to) break the "usually" case described above.

Why "usually be displayed"? If the composite column is evaluated before it is used in the VL expression then it works. The cache prevents the recursion. The order of composite evaluation is complicated. Sometimes the evaluation order works and sometimes it doesn't.
chaley is offline   Reply With Quote