nice... That's a good question...
I'll take a look an report back...
EDIT:
N.O.P.E. I checked the search function including the advanced mode..
I did NOT see any options to make it sort by folder... per-say.....
I did a search of "help" in my FastMail account...
found 193 emails... lol WoW
they seem to be automatically arranged/sorted/grouped by folder...
BUT there is NO obvious folder header or horizontal divider to separate this massive search results I got...
into more easy readable chunks...
go start a support ticket for this great idea...
https://www.fastmail.com/support
EDIT2:
ooh YEaH the search in Classic UI is SO MUCH BETTER, results looks so much more readable being grouped by folder
- folder name/title/header
- horizontal rule to separate each folders readout.. making the entire search result list readable