With #Forgejo v7, there is now experimental code search support. It is currently only available to logged-in users and up to a certain repo size for performance reasons.
Results are generated with git-grep on the fly. We are working on integration with an external search index and also making progress there, but it will take some more time until this is ready.