Trust me, you do not want to do this without a database. (unless you are either insane or into self-torture🙂 )
The sequence is this:
open a file,
fetch all the words from the file,
remove all the noise words that you'll never search for anyway (words like A, THE, ON etc)
then count the occurence of all the different words so you know how many time each word occured in that file.
Put one record into the table, containing the word, the wordcount, and the name of the file it was in.
Do that for all the files, and you have a table containing all the relevant words in all the files.
Then you can do a simple query like:
SELECT filename FROM table WHERE keyword ="hello";
and that will give you all the files that have "hello" in them.
PS 10000 records is nothing for a database. 30 Million, that's "something".