The fastest information search is performed using a search index . Of course, in order to be able to use it, it must first be compiled.
If your project is already using any database that supports full-text search , then it is logical to use it. Otherwise, you should search for any search engine.
One of the most famous search engines is Lucene . The easiest way to install is using nuget . An example of using in .NET.
You can look at hOOt .
Will it always be faster than stupid enumeration of text files? Not. However, even if the number and size of files are relatively small and they can fit entirely in RAM, the use of the index can still be faster: in most cases, downloading files will not be necessary at all.