I have a tag table with a huge data. I need to make an autocomplete textbox and search si开发者_运维技巧milar tag just like stackoverflow. I'm tried mysql LIKE
but it's slow. I'm asking a way to optimize this task.
You can look in Full text indexing, Lucene or Sphinx. Also since you are doing that only on tags you would have to use some n gram tokenizer.
Usually you create an index on long content or at least couple of sentence worth. Most of the tokenizer use space and punctuation to separate words, in your case it would be better to for example separate every 3 characters. So for example if in your your have
host hosting hosted
and an user input host, the engine would search hos + t and find anything having this two combination.
精彩评论