I am trying to implement a search engine using "CONTAINS ()" on SQL Server 2014.
I read here https://technet.microsoft.com/en-us/library/ms142538%28v=sql.105%29.aspx and in the book "Full Text Search Pro in SQL Server 2008", which I need to use double quotes for search for the exact phrase.
But eq, if I use this one CONTAINS(*, '"test"'), I get results containing words like "numerator". If I try CONTAINS(*, '" test "'), it will be the same. I noticed that there are fewer results, as if I were searching with help CONTAINS(*, '*test*')for the prefix, sufix search, so there is a definite difference between the searches.
CONTAINS(*, '"test"')
CONTAINS(*, '" test "')
CONTAINS(*, '*test*')
I did not expect "numerical" in the first statement. Is there an explanation for this behavior?
Contains(*,'"test"') will only match the full words of the "test" as you expect.
Contains(*,'"test"')
Contains(*,'" test "'), as stated above
Contains(*,'" test "')
Contains(*,'"*test*"')will actually search PREFIX ONLY, basically select any special characters at the beginning of the word and use only 2 *. You cannot perform a POSTFIX search using full-text search.
Contains(*,'"*test*"')
My problem is with the Contains (*) part, which will look for any full-text cataloged items in this entire string. Not seeing the data, it's hard to say, but I assume that the other column in this row that you think is bad actually matches the “test”.
, .
"@username", CONTAINS(body, "@username") " ". , @.
CONTAINS(body, "@username")
LIKE "%@username%", , , .
LIKE "%@username%"
CONTAINS LIKE. :
SELECT TOP 25 * FROM table WHERE
CONTAINS(body, "@username") AND body LIKE "%@username%";
, , @username, LIKE , @. 2-3 .
, , , , , , . , .