Thursday, September 24, 2009

70-433 SQL Server - full-text search and stoplists

Create basic full-text search:


  CREATE FULLTEXT INDEX on Courses (Summary) KEY INDEX courseID;


Now if you want to perform a full-text search


  select courseID, summary from courses where contains (*, ' "SQL" AND "2008" ');


If you want to ignore a certain word, say 'CBT', you need to create a STOPLIST


CREATE FULLTEXT STOPLIST myStopList FROM SYSTEM STOPLIST;

ALTER FULLTEXT STOPLIST myStopList ADD 'CBT';


now when you create a full-text search, you can include the STOPLIST:


CREATE FULLTEXT INDEX on Courses (Summary) KEY INDEX CustID

  WITH STOPLIST = myStopList;


No comments: