sql server - SQL Full text search Contains command -
i trying figure out why these 2 statements act differently
select distinct field1, field2 sometable contains(*,'word1') , contains(*,'word2*') , contains(*,'word3')
select distinct field1, field2 sometable contains(*,'"word1" , "word2*" , "word3"')
i specifying indexed fields full text search why 2nd command return nothing first command returns expected results? want search accross fields of fields has word1 , word2 , word3, in 1 contains statement.
i have ran issue before , design. see ms support article.
assume have 2 columns c1 , c2. query listed
contains(*,'"word1" , "word2*" , "word3"')
is interperted as
contains(c1,'"word1" , "word2*" , "word3"') or contains(c2,'"word1" , "word2*" , "word3"')
so every word must in either column (c1 or c2). not return results if word1 in c1 , word3 in c2.
your first query works because interperted as
(contains(c1,'word1') or contains(c2,'word1')) , (contains(c1,'word2*') or contains(c2,'word2*')) , (contains(c1,'word3') or contains(c2,'word3'))
in (the first case) different words can exists in different columns long every word exists in @ least 1 of columns.
Comments
Post a Comment