![]() |
#1 |
Junior Member
![]() Posts: 8
Karma: 10
Join Date: Jun 2017
Device: Kindle Paperwhite
|
Virtual library filtering random books
Hey guys,
I've been using calibre for a while now after learning what I need here and I started organizing my library using the cool virtual library thing. However, I recently noticed a strange problem and I don't know what's going on. So I have a virtual library named standard which uses the search expression "not tag:"=Apples", not tag:"=Oranges"" (not kidding, this is really what it says), and it filters out books which do not at all conform to this (e.g. some that have "D&D, RPG" as their tags. That's... weird. If I disable the virtual library, the book sudenly appears again. Can anyone help me in figuring out what's going on? It'd be much appreciated! |
![]() |
![]() |
![]() |
#2 |
Well trained by Cats
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 31,047
Karma: 60358908
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
![]() A VL does not remove books, It HIDES the ones that does not conform to the filter. If you disable the filter (or switch to 'All Books'), you see the entire library. One of the advantages of a VL is the Search/or Tag browser only operate on the active VL |
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Deviser
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 2,265
Karma: 2090983
Join Date: Aug 2013
Location: Texas
Device: none
|
Think about. If if a book has many tags, and any of them are not apples and not oranges, you will get that book, including if they also have apples and/or oranges.
Example: a book has tags: apples,oranges,peaches,pears. Your search would return that book because peaches are not apples and are not oranges. Ditto for pears. This is true for any metadata column that is "multiple". If you were searching a straight-up single metadata column such as publisher, your search would be fine. DaltonST |
![]() |
![]() |
![]() |
#4 |
Handy Elephant
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,737
Karma: 26785684
Join Date: Dec 2009
Location: Southern Sweden, far out in the quiet woods
Device: Samsung Galaxy Tab S8 Ultra
|
Books can have many tags. Please examine the list of tags for the book you believe should be visible in the VL. I suspect you will find that it after all has the tag Apples or Oranges.
Otherwise you are right that something very strange is going on. You may have had your copy of Calibre changed by high energy cosmic radiation or as an act of some mischievous godlike creature. Or something even stranger. You should be able to rule that out by updating to the latest version of Calibre. If that doesn't help, the strange error may be in the database. Run "Check Library" to see if that helps. If not, make a copy of the book. Delete it from Calibre. Add the book back to Calibre, and see if things work as they should. If the problem still persists, there could perhaps be strange metadata for the book. Please post a copy of the OPF-file for the book that misbehaves here. Or edit the OPF-file and paste the contents here. That could perhaps make it possible for others to reproduce the problem and figure it out. (And verify that there REALLY are no "Apples" or "Oranges" in the tags.) DaltonST: Your description does not seem to match how it works when I try to reproduce the problem. Or perhaps I have gremlings in my computer as well... ![]() Last edited by Adoby; 02-27-2018 at 01:13 PM. |
![]() |
![]() |
![]() |
#5 | |
Deviser
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 2,265
Karma: 2090983
Join Date: Aug 2013
Location: Texas
Device: none
|
Quote:
DaltonST |
|
![]() |
![]() |
Advert | |
|
![]() |
#6 |
Handy Elephant
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,737
Karma: 26785684
Join Date: Dec 2009
Location: Southern Sweden, far out in the quiet woods
Device: Samsung Galaxy Tab S8 Ultra
|
Yes. But we are comparing apples and oranges here...
![]() I am not sure, but your search, as described in the screen dump above, when used in a VL, seems to be the equivalent of: not (tags:"=Apples" and tags:"=Oranges") It would match any book that didn't contain BOTH Apples and Oranges. The search made by the OP was: not tag:"=Apples" and not tag:"=Oranges" which can be rewritten as: not(tag:"=Apples" or tag:"=Oranges") (De Morgan's law) It would match any book that doesn't contain either Apples or Oranges or both. See De Morgan's Law: A OR B = NOT ( NOT A AND NOT B ) ...and that is the same as: NOT ( A OR B ) = NOT A AND NOT B ... that I used above. And the latter result is indeed what Calibre seems to give when used in a VL. Example: a book has tags: Apples,Oranges,Peaches,Pears. The search "not tag:"=Apples" and not tag:"=Oranges"" would NOT return that book, because it contains both Apples and Oranges. (If only one of Apples, Oranges had been present, the result would have been the same.) (I hope I got this right, it was some time ago I read boolean algebra and I got a headache from this...) Last edited by Adoby; 02-27-2018 at 04:33 PM. Reason: Attemted to clarify... sigh... |
![]() |
![]() |
![]() |
#7 |
Deviser
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 2,265
Karma: 2090983
Join Date: Aug 2013
Location: Texas
Device: none
|
Wrong. The MCS query was exactly equal to: ((not tag:"=Apples") AND (not tag:"=Oranges"))
I wrote MCS, so I know how it works. DaltonST |
![]() |
![]() |
![]() |
#8 |
Handy Elephant
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,737
Karma: 26785684
Join Date: Dec 2009
Location: Southern Sweden, far out in the quiet woods
Device: Samsung Galaxy Tab S8 Ultra
|
((not tags:"=Apples") AND (not tags:"=Oranges"))
Yes, that is the correct search. IMHO. But we seem to expect VERY different results? As I said above, this is EXACTLY the same as: not(tags:"=Apples" OR tags:"=Oranges") Try both in a VL and see if they give the results you expect. It's quick to do... I suggested: not (tags:"=Apples" AND tags:"=Oranges") Because that seems to match the result you expect from the screen dump and your description. Last edited by Adoby; 02-27-2018 at 05:51 PM. |
![]() |
![]() |
![]() |
#9 | |
Deviser
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 2,265
Karma: 2090983
Join Date: Aug 2013
Location: Texas
Device: none
|
Quote:
I take into consideration that Tags have an attribute of is-multiple equal to True. That means that there is a separate table entry in books_tags_link for each Tag for each Book. 5 Tags, 5 entries in that table. Each Tag is evaluated separately. 5 evaluations. For a Tag of "apples, oranges, peaches, pears, grapes" then the OP's search results for a book with that Tag would be "False, False, True, True, True". The Trues would cause the book to be selected, even though the first 2 Tags were not desired and returned a False viz a viz returning that book as "selected". Added: see the image of the MCS ToolTip for Final Filters. I should have attached this image previously, since a picture is worth 1,000 words. DaltonST Last edited by DaltonST; 02-28-2018 at 11:34 AM. Reason: Added another image, ToolTips for Final Filters |
|
![]() |
![]() |
![]() |
#10 |
Handy Elephant
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,737
Karma: 26785684
Join Date: Dec 2009
Location: Southern Sweden, far out in the quiet woods
Device: Samsung Galaxy Tab S8 Ultra
|
And I just take in account the actual results that Calibre give when I fill in the tags and create the VLs...
I did a minimal(?) test. Here are the results: The minimal library contains four books with the following titles and tags: "Grapes and Olives": Grapes, Olives "Apples and Oranges": Apples, Oranges "Apples and Lemons": Apples, Lemons "Olives and Oranges": Olives, Oranges There are three VLs with the following names and searches: "NOT A AND NOT B": ((not tags:"=Apples") AND (not tags:"=Oranges")) "NOT ( A OR B )": not (tags:"=Apples" OR tags:"=Oranges") "NOT ( A AND B )": not (tags:"=Apples" AND tags:"=Oranges") Results: The VL "NOT A AND NOT B" contains one book: "Grapes and Olives" The VL "NOT ( A OR B )" contains one book: "Grapes and Olives" The VL "NOT ( A AND B )" contains all books EXCEPT the book "Apples and Oranges". Comments: The two VLs "NOT A AND NOT B" and "NOT ( A OR B )" seem to be functionally identical, and either can be used as the "Standard" VL in the OP. The VL "NOT ( A AND B )" give the result you seem to expect from the VL "NOT A AND NOT B"? Is there a bug in Calibre or do I do something wrong when I create the VLs or the tags? |
![]() |
![]() |
![]() |
#11 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,345
Karma: 27182818
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
NOT A and NOT B is logically identical to NOT (A or B) and neither is the same as NOT (A and B).
NOT (A and B) is however the same as NOT A or NOT B. NOT (A and B) in your case means all books that do not have Apples or do not have Oranges in their tag list, which if I am reading your example correctly is three books, as expected. |
![]() |
![]() |
![]() |
#12 |
Junior Member
![]() Posts: 8
Karma: 10
Join Date: Jun 2017
Device: Kindle Paperwhite
|
Edit: Got it fixed now. Based on what you guys discussed, I simply changed the command to "not(tags:"=Apples" OR tags:"=Oranges")" and that did the trick.
I'm not entirely certain why that'd be, but it's certainly fine with me! Thanks guys! Last edited by Gilgeam; 03-05-2018 at 12:22 PM. |
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Exclude Comic Books from Virtual Library? | MarjaE | Library Management | 4 | 12-13-2017 03:35 AM |
Filtering Books in Library That Came From Amazon? | htrej | Library Management | 5 | 08-29-2016 11:59 AM |
Creating a virtual library according how many books by author | mariaclaudia | Calibre | 5 | 06-04-2015 12:03 AM |
Books Disappear from Virtual Library. | alanHd | Library Management | 2 | 01-19-2014 05:29 PM |
putting virtual books on kobo onto calibre library | apples | Kobo Reader | 6 | 02-23-2013 05:04 PM |