In my Android app, I want to have an autocomplete input field. The number of elements will be around 300,000. The best solution seems to be to put the elements in a file (on sdcard), one element per line, each line will have the same number of characters so that I can search for a specific line number. If the user enters something in the text box, I would have a binary search (via RandomAccessFile) file and show the sentences.
I want autocomplete to be super fast (ideally up to 100 ms, but I think it's impossible), what optimizations can I do?
Update 1:
I will convert user input to lowercase English characters (az) with spaces. Thus, "A / b" will be converted to "a b", and then a search will be performed.
Uodate 2:
Now I realized that I need an extra thing - look for source substrings.
source
share