posted 13 years ago
I have a problem where I have a lookup table of about 1,000,000 key/value pairs, and the ids that I have to find are not always exactly complete. Easier to show in an example:
IDs
----------
ABCD
EFGH
IJKL
1234
Lookup Table
----------------
Key/ Value
-----/ ------------
ABCD:ILK/ Val1
EI:1234 / Val2
cIJKL:39D9/ Val3
One thing I tried was to nix everything after the colon in the key, but as you can see on the last one there is sometimes a character before the ID. One very inefficient way is to read them into parallel arrays and search through the keys for each ID I am trying to look up and use a string.contains(). But like I said there are approx. 1 million key/value pairs and this is just to slow...ran it for about 15 minutes and still wasn't finished. BTW, just thinking about iterating through the keys and doing my lookups in my ID list, but that list is 1500+ so that is less than ideal as well.
So does anyone have any other ideas on how I could complete these lookups?