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-16-2021, 05:33 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: 9,369
Karma: 64435965
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
Saved Searches: Recursing hierarchical searches

EDIT: "Recursing" probably isn't the right word here. I was thinking more of something similiar to the the divide-and-conquer algorithm, where a task is split up into a bunch of smaller tasks and then combined back together.

I've been starting to split up my monstrous long "Cleanup" saved search. However, I just wanted to make sure this wouldn't cause any issues.

Example: If I have this hierarchy:

Cleanup
Cleanup.Missing Metadata
Cleanup.Missing Metadata.Missing Page Count
Cleanup.Missing Metadata.Missing Language
Cleanup.Fanfiction
Cleanup.Fanfiction.Fanfics with Errors

Would there be any problem if I nested these?

Cleanup would be
search:"=Cleanup.Missing Metadata" OR search:"=Cleanup.Fanfiction"

While Cleanup.Missing Metadata would be
search:"=Cleanup.Missing Metadata.Missing Page Count" OR search:"=Cleanup.Missing Metadata.Missing Language"

This seems like the best way to split it up, but I don't want to break things!


Last edited by ownedbycats; 01-17-2021 at 01:09 AM.
ownedbycats is offline   Reply With Quote
Old 01-16-2021, 06:01 PM   #2
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: 9,369
Karma: 64435965
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
I split it successfully (saved my monster search to a text file in case I need to revert it). Works right so long as all the subsearches are valid. But splitting it up makes it easier to track down where an error is.

Performance seems to be a bit better too. There was a tiny lag on my old search that's gone now.
Attached Thumbnails
Click image for larger version

Name:	2021-01-17 00_43_56-Window.png
Views:	192
Size:	15.9 KB
ID:	184781  

Last edited by ownedbycats; 01-17-2021 at 01:07 AM.
ownedbycats is offline   Reply With Quote
Advert
Old 01-17-2021, 07:04 AM   #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: 11,963
Karma: 7225107
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by ownedbycats View Post
EDIT: "Recursing" probably isn't the right word here. I was thinking more of something similiar to the the divide-and-conquer algorithm, where a task is split up into a bunch of smaller tasks and then combined back together.
The right word is "nesting", and as you discovered there isn't a problem with that.

Recursion means X uses itself to compute the answer; X calls X directly or indirectly. Recursion requires that X have a "termination condition"; a situation where X returns a value instead of calling X. This allows the call chain to undo and return a value. If there is no termination condition then X will call X forever, eventually running out of memory or some other resource. Saved searches do not have termination conditions so recursion is not allowed by the search parser.

This Wikipedia article discusses recursion both formally and informally.
chaley is offline   Reply With Quote
Old 01-17-2021, 03:00 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: 9,369
Karma: 64435965
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
The only issue I found with the nesting is that you can't omit a subsearch, e.g.
search:"=Cleanup" AND NOT search:"=Cleanup.Missing Metadata.Missing Pagecount"
will come up invalid, presumably because Cleanup (indirectly) calls Missing Pagecount—seems intentional enough that I won't file a bug report over it. But I can just do an OR search for all the subsearches except Missing Pagecount.

Last edited by ownedbycats; 01-17-2021 at 03:05 PM.
ownedbycats is offline   Reply With Quote
Old 01-17-2021, 03:58 PM   #5
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: 11,963
Karma: 7225107
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
The check-for-recursion test is approximate because the search parser doesn't maintain a call (recursion) stack. Instead it uses the heuristic that a search must be recursive if the search expression executes the same saved search more than 5 times. For example, this search doesn't fail:
Code:
search:"b" or search:"b" or search:"b" or search:"b" or search:"b"
but this search does fail:
Code:
search:"b" or search:"b" or search:"b" or search:"b" or search:"b" or search:"b"
Assuming your searches aren't actually recursive, my guess is that is what is happening to you.
chaley is offline   Reply With Quote
Advert
Old 01-17-2021, 04:01 PM   #6
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: 9,369
Karma: 64435965
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
Cleanup contains (search:"=Cleanup.Missing Metadata"), and Cleanup.Missing Metadata contains (search:"=Cleanup.Missing Metadata.Missing Pagecount").

I did test the recursion though just to see what would happen - two searches called foo and bar that try to call each other results in a red invalid search border.
ownedbycats is offline   Reply With Quote
Old 01-17-2021, 04:04 PM   #7
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: 11,963
Karma: 7225107
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
When you get a recursion error the tooltip on the search box tells you what saved search calibre has seen more than 5 times.
chaley is offline   Reply With Quote
Old 01-18-2021, 05:33 AM   #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: 11,963
Karma: 7225107
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
I changed the "recursion" limit count from 5 to 10.
chaley is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Saved searches in tag_browser_category_order ownedbycats Calibre 2 10-07-2020 10:41 AM
Saved Searches? jim3692 Sigil 3 04-26-2020 06:10 PM
group saved searches Katja_hbg Library Management 1 02-04-2018 12:28 AM
Saved searches abecedarian Sigil 5 04-14-2017 06:48 PM
Where are searches saved? travger Calibre 2 08-26-2012 01:37 PM


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


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