Thursday, March 31, 2011

How to disable word stemming in SQL Server Full Text Search?

I need to do a Full Text Search with NO word stemming...I tried to wrap the term I'm searching in double quotes, but no joy... I still get results like "bologna" when I search for '"bolognalo"'

Any help is appreciated..

From stackoverflow
  • Maybe setting the language of the fulltextindex to neutral will do the trick...

    (Though, then you'd never get stemming at all...)

  • Switch from using FREETEXT to CONTAINS.

    I assume that you're currently using FREETEXT because stemming is automatically applied to FREETEXT queries, whereas CONTAINS doesn't use stemming by default.


    A second, inferior, option is to specify language neutrality in your FREETEXT query:

    SELECT *
    FROM my_table
    WHERE FREETEXT(my_column, 'my search', LANGUAGE 0x0)
    

    If you use this then no other language-specific rules will be applied either (eg, word breaking, stopwords etc).

  • After too many days spend in try, finally i can do these: I recreate catalog setting the language to 0 (neutral)

    CREATE FULLTEXT INDEX ON table_name (DescriptionField LANGUAGE 0) KEY INDEX idx_DescriptionField ON catalog_name

    and after in each query with contains i setted the language to 0

    select * from table_name where contains(DescriptionField,'bolognolo',LANGUAGE 0)

    Before i can't do these because I didn't do the first step

    Thank you very much!

0 comments:

Post a Comment