Microsoft's documentation for CONTAINS includes the following two clauses in their examples.
CONTAINS(Name, ' "Mountain" OR "Road" ')
And also...
CONTAINS(Description, ' Aluminum AND spindle ');
Note that the first example places both search terms within double quotes while the second example does not. I cannot seem to find anyplace where it explains what is the difference between the two.
Since neither FORMSOF(INFLECTIONAL, ...) or FORMSOF(THESAURUS, ...) are used, I can only assume that the words are compared literally in both cases. That would mean both versions are equal. So why include them in double quotes in the first example?
It is my understanding that quotes are only strictly required when a search phrase contains a wildcard or multiple words. If the search phrase is a single word and does not user a wildcard, then strictly speaking, double-quotes are not required.
CONTAINS(LastName, 'Anders') --double quotes not required
CONTAINS(LastName, '"Anders*"') --double quotes required since wildcard used. Match Anders, Anderson, etc
CONTAINS(Title, '"End of time"') --double quotes required, since multiple words
Of course, double quotes can still be used even when they are not required:
CONTAINS(LastName, '"Anders"')
Here is a quote BOL regarding the need for double quotes when a wildcard is used:
If the text and asterisk are not delimited by double quotation marks, so the predicate reads CONTAINS (column, 'text*'), full-text search considers the asterisk as a character and searches for exact matches to text*.>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With