Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Library Management

Notices

Reply
 
Thread Tools Search this Thread
Old 01-02-2022, 06:16 PM   #1
ownedbycats
Custom User Title
ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.
 
ownedbycats's Avatar
 
Posts: 10,974
Karma: 75337983
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
Strangeness when referencing VLs in other VLs

I have a virtual_libraries() column. However, I'm having a bit of a strange interaction with it and I'm not sure if it's a glitch or some sort of strange user error.

I have two VLs here:

Fiction: tags:"=.Fiction"

Cleanup: search:"=Cleanup"

I wanted to hide all the "Cleanup" books in the Fiction VL. So I did this:

tags:"=.Fiction" AND NOT #vls:"=Cleanup"

This search worked as expected when I tested it in All Books. But when I put it into the Fiction VL itself, it results in every VL disappearing from books that have a tag starting with Fiction.

Here's one book before and after modifying the VL:

Click image for larger version

Name:	2022-01-02 19_04_57-Tailchaser's Song.jpg
Views:	71
Size:	163.8 KB
ID:	191275

Click image for larger version

Name:	2022-01-02 19_06_20-Tailchaser's Song.jpg
Views:	72
Size:	164.0 KB
ID:	191276

The weird part is that all the VLs are still returning their correct books, and if I use template tester to run virtual_libraries() directly on those books, it still shows the correct ones:

Click image for larger version

Name:	2022-01-02 19_07_52-Template tester.png
Views:	68
Size:	23.9 KB
ID:	191277





I did some further testing too. Two VLs here:

Physical Books: formats:paperbook

Loans: formats:overdrive


No overlapping books between the two of them. But when I changed VL to formats:paperbook AND NOT #vls:"=Loans" I got the same results: VLs disappearing from books with a paperbook format, virtual_libraries() giving expected results.

Any clue what might be happening here?

Last edited by ownedbycats; 01-02-2022 at 07:30 PM.
ownedbycats is online now   Reply With Quote
Old 01-02-2022, 07:26 PM   #2
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,447
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
One possible problem: the search term for virtual libraries is "vl", not "vls". Try not using your column but using the underlying search term.

Do you really mean identity search? Don't you want contains?

EDIT: I haven't been able to make it fail in the same way.

Last edited by chaley; 01-02-2022 at 07:31 PM.
chaley is offline   Reply With Quote
Advert
Old 01-02-2022, 07:35 PM   #3
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,447
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Yes I can repeat it. VL search expressions shouldn't contain references to columns that use virtual_libraries(). The virtual_libraries() caching mechanism doesn't support recursion. This isn't something I am interesting in fixing.
chaley is offline   Reply With Quote
Old 01-02-2022, 07:39 PM   #4
ownedbycats
Custom User Title
ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.
 
ownedbycats's Avatar
 
Posts: 10,974
Karma: 75337983
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
My column is #vls -- I built the search from the tag browser just to make sure I didn't make a typo.

tags:"=.Fiction" AND NOT vl:Cleanup resulted in the VLs staying in book details.
ownedbycats is online now   Reply With Quote
Old 01-02-2022, 07:40 PM   #5
ownedbycats
Custom User Title
ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.
 
ownedbycats's Avatar
 
Posts: 10,974
Karma: 75337983
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
Quote:
Originally Posted by chaley View Post
Yes I can repeat it. VL search expressions shouldn't contain references to columns that use virtual_libraries(). The virtual_libraries() caching mechanism doesn't support recursion. This isn't something I am interesting in fixing.
In that case it might make more sense to have my VL reference the Cleanup search instead of the VL.
ownedbycats is online now   Reply With Quote
Advert
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,447
Karma: 8012886
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
Old 01-03-2022, 02:50 PM   #7
ownedbycats
Custom User Title
ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.
 
ownedbycats's Avatar
 
Posts: 10,974
Karma: 75337983
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
That makes sense.

Would the same issues occur if a VL was referenced in a saved search used by a different VL?
ownedbycats is online now   Reply With Quote
Old 01-03-2022, 03:59 PM   #8
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,447
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by ownedbycats View Post
That makes sense.

Would the same issues occur if a VL was referenced in a saved search used by a different VL?
It depends on the type of reference. if the VL search references a saved search that uses virtual_libraries() then yes, probably. The bottom line: the safest approach is to never use virtual_libraries() in a VL search, directly or indirectly.
chaley is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Where are saved searches and VLs kept in the database? ownedbycats Library Management 2 04-15-2021 01:20 PM
Combining saved searches for VLs ownedbycats Library Management 1 12-04-2020 05:46 AM
Touch referencing fonts tshering Kobo Reader 14 07-07-2012 12:52 PM
KF8 strangeness jgaiser Conversion 2 05-09-2012 01:20 PM
Strangeness? Dimwit Kobo Reader 3 07-20-2011 09:17 PM


All times are GMT -4. The time now is 01:14 PM.


MobileRead.com is a privately owned, operated and funded community.