Step By Step Procedure for Full Text Search in Sql Server 2005

Step By Step Procedure for Full Text Search in Sql Server 2005

Step 1: Enable Full Text Search

EXEC sp_fulltext_database 'enable'

Step 2: Create a Catalog

CREATE FULLTEXT CATALOG mySites

Step 3: Create Full Text Index for columns

CREATE FULLTEXT INDEX ON Sites
(
SiteName,
Categories,
Address1,
Address2
)
KEY INDEX PK_Sites ON mySites
WITH CHANGE_TRACKING AUTO

Step 4:

Example for CONTAINS search...

SELECT SiteName
FROM Sites
WHERE CONTAINS(Categories, '"LIC India"')

Example for Free Text search...


DECLARE @SearchWord varchar(30);
SET @SearchWord ='LIC India';
SELECT SiteName FROM Sites
WHERE FREETEXT(Categories, @SearchWord)



Step By Step Procedure for Full Text Search in Sql Server 2005

No comments: