CamelVeeFolder: Propagate searches into subfolders
Running Evolution 3.32.4 on Fedora 30.
I have an IMAP inbox containing several thousand messages and a search folder which simply matches all the messages in Inbox and Sent.
Recently when I ran a full text search ("Message contains...in Current Folder") on Inbox, the results were returned in seconds. However, the same full text search on the search folder seemed to get stuck at "Generating Message List". In fact it took several minutes to complete, while subsequent searches on that search folder were much faster.
The imap logs (CAMEL_DEBUG=imapx evolution) suggest the following explanation. It seems that running the search directly on an IMAP folder will query the server for the UIDs of matching messages ("UID SEARCH BODY keyword") and construct the results from the UIDs. In comparison, when Evolution executes the search on the search folder, it first downloads all the message bodies in the Inbox and then runs the search locally. Indeed I found all the message bodies downloaded after the first successful search on the search folder.
Steps to reproduce:
- Begin with a large IMAP Inbox (1000 messages or more) for which the message bodies are not stored locally (for instance, clear the Evolution cache).
- Run a full text search on the Inbox.
- Construct a search folder which matches all items in Inbox.
- Run the same full text search on the search folder.
- Observe that the latter search takes much longer, and that the messages bodies have been downloaded when it completes.
Expected behavior: When searching a search folder, Evolution should use server-side search for each of the remote sources and then apply the search folder conditions to the matches.
Actual behavior: All message bodies in the search folder are first downloaded and then searched locally.