What would be the best way to implement search by substring on Strings(around 5000 entity names in application) which map to entityId.
I want to implement it so that I could put searched suggestions to the user as he types in one or more characters.For e.g I would want to be able to suggest all entities starting with his queried substring as he does the search.
Looking forward to store them in the application scope itself to avoid frequent retrievals from DB.
It sounds like you need some sort of trie structure. As the user types characters, you could return a subset of leaf-nodes under the node mapped by what they’ve already typed.
Google has a trie implementation you could possibly adapt.