Full text exact phrase match is not returned

Answered Full text exact phrase match is not returned

  • 2012년 7월 5일 목요일 오후 12:24
     
     

     In sql server 2008 FULL TEXT search i have searched for exact phrase. But the return results contains some unmatched results

    Ex:

    Declare @str varchar(100)

    set @str=' "Jaw pain" '

    select * from table contains(tblColumn,@str)

    returns matching records(i.e exactly Jaw pain) and also jaw (pain,tightness).

    How to resolve this?


    Thanks
    Ganesh Kumar M

모든 응답

  • 2012년 7월 5일 목요일 오후 7:27
     
     답변됨 코드 있음

    Sorry, but according to the full text indexing rules  (  does not exist.  So "Jaw Pain" and "jaw (pain" are exactly the same to the full text engine.   Also, notice that the SQL Server full text indexing does not recognize different sentences and so forth.

    If this is a problem use the Contains query to produce a derived table, then add a Like search to find the exact string.

    Declare @str varchar(100)
     
    set @str=' "Jaw pain" '
     
    SELECT * 
    FROM (select KeyColumn, tblColumn from yourtable where contains(tblColumn,@str)) AS FTSearch
    WHERE FTSearch.tblColumn LIKE '%'+@str+'%'

    The full text will be faster than scanning all the strings (normally) then the LIKE will filter down to what you want.

    RLF