I use Recoll:
https://www.lesbonscomptes.com/recoll/
There is a GUI, but it has a perfectly serviceable command-line interface as well. For example, this command lists all files with the exact phrase 'moved permanently':
recoll -t -l '"moved permanently"'
And this command finds all files ending in '.py' and under a directory called 'Dropbox' that contain the exact words "import" and "logging":
recoll -t -l "ext:py dir:Dropbox/ Import Logging"
It can take some time and effort to configure, but I have found it to be well worth it.