3 ms·
Instant Word Search : Something I wrote for fun
- kirubakaran 19y agoIt is silly, really. But I just thought I'll share anyway.
- ivankirigin 19y agoNot so instant for me :-P
- paulgb 19y agoI found the same. You must be using LIKE across the whole dataset? Why not build a hash table with every two-letter combination as they keys and the index of every word containing that combination as the value? That should narrow down the number of words you have to search through for each query, and it could all be done in MySQL with a many-to-many relation.
- kirubakaran 19y agoI use a text file (not db). I too thought that partitioning it would give a better performance. But profiler disagreed. I use nearlyfreespeech.net, and they don't support FastCGI yet. Thats the bottleneck. I am planning to try this in EC2... to see what happens.
- kirubakaran 19y agoIt is much faster now.
- aston 19y agoIf you're actually into making this more awesome, you almost certainly want to put this together with some in-memory data structure. And that data structure should probably be a suffix tree/trie. Check it out: http://en.wikipedia.org/wiki/Suffix_tree http://en.wikipedia.org/wiki/Suffix_tree. You'd need to modify that to deal with having more than one word, but that's not too bad (you just lay the trees on top of each other).
- kirubakaran 19y agoThanks a lot!