Indexing File Contents
You can try recoll
, it is available in the repositories, it gives you a lot of control over the folders you want to index and search and where you want to store the index database, you can use multiple databases too, you can use the advanced search to return results from a specific folder.
See some of its features here, You can run it from the command line passing the query and other control terms to it, see the short manual here. Here the full manual.
You can use ack-grep (a cli tool), it mainly useful for code projects if that's your use case.