It appears MySQL FullText index does not index the word 'C#'. Probably because the character '#' is removed and you are left with C, which is too short to index.

My question is, how would I go about indexing 'C#' so that it is searchable in my FullText index?

Thanks,

John

link|improve this question
feedback

3 Answers

I think this can be solved tuning the ft_min_word_len system variable, which is used to set the minimum length of words to be indexed. Set this value to two. More info here.

link|improve this answer
Thanks for the reply. However, I don't think setting the minimum length to 1 is a good idea. I don't want to index 'C'. I want to index 'C#'. – postalservice14 May 17 '10 at 15:07
set ft_min_word_len to 2 :) – Marco Ramos May 17 '10 at 17:17
feedback

I don't know of a way to do this, and searching around it seems to be accepted as a limitation of fulltext search in MySQL.

I guess you already considered this, but just in case: you can encode non-searchable characters before storing the data in your database. So C# would become C.Sharp, C++ would become C.Plus.Plus, etc.

link|improve this answer
feedback

You can upgrade ft_min_word to allow 2 characters, by default this is set to 4 characters, which to most people is a little to much, 3 would be more suitable. I have mine set to 2.

Also amongst the configuration files of MySQL full-text, you can alter a list of ignored words. I have yet been in the myself but you may find # as one of the ignored words/symbols...

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.