searching word or phrase among files
As poined out in the comments, your current approach might be too slow for your goal of "about 4-5 seconds". Depending on what's your actual use case, using an index might indeed be a good idea. This is similar to how internet search engines do it.

To create the index:


create a map Map&lt;String, List&lt;File&gt;&gt; for holding the association of search terms to files
go through all your files, and for each word in each file, add that file to the list corresponding to that word in your index map
you might want to skip common words, such as "a", "and", "the", etc., or you could even apply a stemmer to drastically reduce the variability in words


Once you've created the index (which could take quite some time), you just have to look up the search word in that index to get the list of files that contain the word (or a linguistic variant of it, if you used a stemmer).

As said before, the applicability of this approach depends heavily on your actual use case. If the files contain genetic sequences and you are searching a certain pattern, this probably won't help much. Even if you are searching for some complex phrase this might not work, as you'd have to add each possible (sub) phrase to the index. But if you are looking for individual words in ordinary text files (or HTML or the like) this might work.

Update: Since you seem to indeed search for complex phrases, you could try the following: 


create the index, as desribed above, optionally using a stemmer
search for each word in your phrase (or the stemmed version thereof) in your index
for each file that, according to your index, contains all the words, do a full-text search for the original phrase


Finally, if this still does not cut it, you could also create indexes for word bigrams or even trigrams.