Perhaps the best way to do this is to compress the document, as this will remove any duplicate copies of words that you really only need to check spelling once. I suggest this only because it will probably be faster than writing your own unique search engine.
The compressed version should have links to unique words, somewhere inside its file, you may have to see how they are structured.
Then you can check all the unique words. I hope that you do not check them with separate SQL queries or something like that, you should load the dictionary in the form of a tree into your memory, and then check the words for that.
Once this is done, just unzip it, and above all, the entire spell will be checked. This should be a pretty quick fix.
Or maybe you donβt have to go through the whole zipping process if the spellcheck is really as fast as the comments suggest, which indicates an incorrect implementation.
Tom gullen
source share