As phrased, the question seems to exclude my answer, because the search is not performed within Calibre, but it appears to be the best solution for my use case, so might be helpful to add here.
- Use Calibre to convert all books to plain text.
- Optionally, merge all of the plain text books into a single "book," depending on your preferred search tool (I think you can convert and merge in one job instead of two, but only if the books are all in the same format).
- Search the new text file(s) with grep, Search > Find in Files (Ctrl+Shift+F) in Notepad++, or whichever search tool you prefer. Obviously a lot of options, including grep, are happy to search the contents of multiple files at once, so merging the books isn't strictly necessary - but a single file is arguably tidier, so may be better for many people's purposes.
Based primarily on this question about grep on ebooks, it seems that a more elegant solution using only Calibre or only a few CLI commands piped together should be possible, but depending on what you want to do next, my solution is only marginally worse or just as good in practice (just aesthetically unpleasant).
For example, if you want to go directly from the search results to a match in the original ebook, my solution might be pretty tedious to use. But "whatever tool you prefer" could mean an elaborate script you wrote which uses grep or similar to find matches in the text file(s), then allows you to select a match, then makes use of Calibre CLI to open the book in Calibre and use Calibre's normal single book search function to search for the text it found with grep.
My more complex option unfortunately includes virtually no explanation of how to accomplish all of that, but just converting books to text and doing a simple search might be a perfectly efficient solution for OP and a lot of other people.