Register Guidelines E-Books Search Today's Posts Mark Forums Read

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

Notices

Reply
 
Thread Tools Search this Thread
Old 01-16-2021, 06:33 PM   #1
ownedbycats
Wizard
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.
 
Posts: 1,865
Karma: 5140624
Join Date: Oct 2018
Device: Kobo 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 02:09 AM.
ownedbycats is online now   Reply With Quote
Old 01-16-2021, 07:01 PM   #2
ownedbycats
Wizard
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.
 
Posts: 1,865
Karma: 5140624
Join Date: Oct 2018
Device: Kobo 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:	28
Size:	15.9 KB
ID:	184781  

Last edited by ownedbycats; 01-17-2021 at 02:07 AM.
ownedbycats is online now   Reply With Quote
Old 01-17-2021, 08:04 AM   #3
chaley
Grumpy old git
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: 9,555
Karma: 3125810
Join Date: Jan 2010
Location: UK
Device: Reader
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, 04:00 PM   #4
ownedbycats
Wizard
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.
 
Posts: 1,865
Karma: 5140624
Join Date: Oct 2018
Device: Kobo 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 04:05 PM.
ownedbycats is online now   Reply With Quote
Old 01-17-2021, 04:58 PM   #5
chaley
Grumpy old git
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: 9,555
Karma: 3125810
Join Date: Jan 2010
Location: UK
Device: Reader
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
Old 01-17-2021, 05:01 PM   #6
ownedbycats
Wizard
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.
 
Posts: 1,865
Karma: 5140624
Join Date: Oct 2018
Device: Kobo 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 online now   Reply With Quote
Old 01-17-2021, 05:04 PM   #7
chaley
Grumpy old git
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: 9,555
Karma: 3125810
Join Date: Jan 2010
Location: UK
Device: Reader
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, 06:33 AM   #8
chaley
Grumpy old git
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: 9,555
Karma: 3125810
Join Date: Jan 2010
Location: UK
Device: Reader
I changed the "recursion" limit count from 5 to 10.
chaley is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

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


All times are GMT -4. The time now is 06:56 PM.


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