View Single Post
Old 11-15-2020, 11:18 AM   #197
DaltonST
Deviser
DaltonST ought to be getting tired of karma fortunes by now.DaltonST ought to be getting tired of karma fortunes by now.DaltonST ought to be getting tired of karma fortunes by now.DaltonST ought to be getting tired of karma fortunes by now.DaltonST ought to be getting tired of karma fortunes by now.DaltonST ought to be getting tired of karma fortunes by now.DaltonST ought to be getting tired of karma fortunes by now.DaltonST ought to be getting tired of karma fortunes by now.DaltonST ought to be getting tired of karma fortunes by now.DaltonST ought to be getting tired of karma fortunes by now.DaltonST ought to be getting tired of karma fortunes by now.
 
DaltonST's Avatar
 
Posts: 2,265
Karma: 2090983
Join Date: Aug 2013
Location: Texas
Device: none
CalibreSpy does not use Calibre's VLs, but rather emulates them...

If you run CalibreSpy from a .bat file, or run with Calibre in debug mode from the start using "calibre-debug -g ", you will get an explanation of what CS is doing with your Calibre VLs.

CS does not use Calibre's VLs, but rather emulates them (analogous to how WINE emulates Windows in Linux) by converting them into SQL and running that dynamic SQL against metadata.db. It loads the VLs from Calibre only one time, so if you change them in Calibre while using CalibreSpy, the changes will not appear in CalibreSpy until you restart it or run another instance of CalibreSpy via a .bat file.

Therefore, there may be a few subtle differences that work in Calibre but not CalibreSpy.

See below in bold red.

CS interprets #cs_tag_hierarchy:"=.Factual" as meaning "show me .Factual (literally)". It found one (1) book with a value of exactly .Factual.


CS interprets #cs_tag_hierarchy:=.Factual as meaning "show me any of the taglike-tags having Factual as a value. It found 26 books with a value equal to Factual or starting with Factual, such as Factual.Business.Finance.Accounting.CostAccounting .


The quotes mean "exactly" to CS in this particular case.


Code:
Selected:   S:/Calibre/CalibreJobSpyTest1
Unsupported VL:  ((formats:true) and (marked:true))    reason:  marked:
Unsupported VL:  A Fortune for Kregen    reason:  No Colons -  ':'
Unsupported VL:  Larry Niven    reason:  No Colons -  ':'
Unsupported VL:  Tweak Author Sort for Complex Surnames    reason:  No Colons -  ':'
Unsupported VL:  error:  @asdfasdf   search:asdfasd    reason:  Both '@' and 'search:' used in the same VL
Unsupported VL:  error:  @asdfasdf AND @dasdfd    reason:  Only 1 @UserCategory criterion is allowed.
Unsupported VL:  selected:true    reason:  selected:
Unsupported VL:  thelma adams    reason:  No Colons -  ':'
Unsupported VL:  vl:@MyColors:true or vl:search:example_    reason:  Both '@' and 'search:' used in the same VL
------------------------------------------------------
VL Selected:   obc6: #cs_tag_hierarchy:"=.Factual"
SQL Query:

SELECT id AS books_id FROM books WHERE EXISTS (SELECT book FROM books_custom_column_41_link WHERE book = books.id AND value IN (SELECT id FROM custom_column_41 WHERE value  REGEXP  '.factual'))  ;

total number of books found:  1   for VL criteria: #cs_tag_hierarchy:"=.Factual"
------------------------------------------------------
VL Selected:   obc5: #cs_tag_hierarchy:=.Factual
SQL Query:

SELECT id AS books_id FROM books WHERE (EXISTS (SELECT book FROM books_custom_column_41_link WHERE book = books.id AND value IN (SELECT id FROM custom_column_41 WHERE value REGEXP '^factual[.]*.*$')) OR EXISTS (SELECT book FROM books_custom_column_41_link WHERE book = books.id AND value IN (SELECT id FROM custom_column_41 WHERE value = 'factual'))  )  ;

total number of books found:  26   for VL criteria: #cs_tag_hierarchy:=.Factual


..............


Your other issue was:

Quote:
having AND NOT tags:@cleanup anywhere in the VL query triggers an error about the user category not being at the beginning of the criteria.
Correct. If you want a Calibre VL to work with CalibreSpy, the Calibre VL must be able to be converted to SQL by CS. Hence, there are a few rules, most of which are displayed in the log when you run CS from a .bat file or from Calibre itself while in debug mode. See the "Unsupported VL:" items in the log, above.

User Categories in VLs have special conditions to be usable in CS, as you discovered. Simply change your VL in Calibre to comply with the stated rules if you want to use that specific VL in CalibreSpy.

I highly recommend running CalibreSpy from a .bat file (or simultaneously from many .bat files for different Libraries) so that you see what is going on within the CS run log if you encounter scenarios that you do not understand.




DaltonST
DaltonST is offline   Reply With Quote