The other day was a SQL learning adventure. A team member was trying to find the phrase "Q&A" using the search functionality of our product, but found no results. They were surprised at this considering they had proof the phrase should have been returned. Lucky me got tasked with investigating this issue. This search was just running a contains query against a table in SQL Server 2005. I figured it was probably something silly our application was doing, so I ran the query directly on the database. Surprisingly, there were no results returned.
The next step was to try and create a simple repro. I created a new table, setup full text, and inserted "Q&A" as the only record. Sure enough, the contains query returned no results. At this point I was suspecting the "&" so I tried querying for "QA" thinking maybe it was filtering the "&" out. Again, no results. Being somewhat knowledgeable about full text, I suspected the word breaker was causing the problem.
The word breaker takes the incoming text and breaks it up into logical words for indexing. For example, "blogs rule" would be broken up into two words, "blogs" and "rule." You would expect the phrase "Q&A" not to be broken up, but in fact it is. The word breaker returns "Q" and "A," both of which are noise words causing nothing to be indexed.
So after the lesson in word breakers, I was left with the unfortunate ending of resolving the bug as "By Design." Maybe next month I can detail the workaround I found.