OK, I think I understand what you're looking for and here are some possible solutions for you:
- What is the best autocomplete/suggest algorithm,datastructure [C++/C] (the answers are generic enough despite the fact that it's a C/C++ question)
- How to implement autocomplete on a massive dataset
- Autocomplete using a trie
- Algorithm for autocomplete?
- Trie based addressbook and efficient search by name and contact number
- How do you autocomplete names containing spaces?
Essentially, it seems like you're looking for auto-complete functionality (if I understood your question correctly). Along those lines, the above questions and their answers also provide a lot of references on how to do more complex suggestions (i.e. based on content, semantics, intent, etc.).
This will probably not address your question if you're looking for an algorithm that makes "related" suggestions, e.g.:
- "water" may suggest kool-aid, gatorade, vitamin water.
- "sea" may suggest ocean, lake, river