Kentico CMS 7.0 Developer's Guide

Enabling full-text search on MSSQL Server (Script)

Enabling full-text search on MSSQL Server (Script)

Previous topic Next topic Mail us feedback on this topic!  

Enabling full-text search on MSSQL Server (Script)

Previous topic Next topic JavaScript is required for the print function Mail us feedback on this topic!  

If you cannot use SQL Server Management Studio to configure the full-text search, run the following script against your Kentico CMS database:

 

-- Allows IFilter library loading

exec sp_fulltext_service 'verify_signature', 0

exec sp_fulltext_service 'load_os_resources', 1

 

-- Creates the Full Text Catalog

exec sp_fulltext_catalog 'KenticoCMSCatalog','create'

 

-- Adds the CMS_Attachment table to the catalog

exec sp_fulltext_table 'CMS_Attachment','create','KenticoCMSCatalog','PK_CMS_Attachment'

 

-- Sets the data column of the CMS_Attachment table in the catalog

exec sp_fulltext_column 'CMS_Attachment','AttachmentBinary','add',NULL,'AttachmentExtension'

 

-- Populates the catalog

exec sp_fulltext_table 'CMS_Attachment','start_full'

 

You can now search through the content of basic files types stored in the database. See also:

 

Searching PDF files

Searching Microsoft Office documents

 

Enabling attachment search for the SQL search

 

Perform the following steps if you wish to search attachments using the SQL search:

 

 

InfoBox_Exclamation

 

Note

 

The SQL search engine is obsolete. It is recommended to use the Smart search instead. In that case you only need to enable the Search in attachments property of the relevant smart search results web parts.

 

 

1. Sign in to Site Manager and go to Development -> Document types.

2. Edit the Root document type.

3. Open the Queries tab.

4. Edit the searchattachments query and uncomment the following part of the code:

 

SELECT View_CMS_Tree_Joined.*, View_CMS_Tree_Joined.NodeName AS SearchResultName

FROM CMS_Attachment INNER JOIN View_CMS_Tree_Joined

ON View_CMS_Tree_Joined.DocumentID = CMS_Attachment.AttachmentDocumentID

WHERE (##WHERE##) AND

(([AttachmentName] Like N'%'+ @Expression + N'%') OR ([AttachmentTitle] Like N'%'+ @Expression + N'%') OR ([AttachmentDescription] Like N'%'+ @Expression + N'%')) OR (FREETEXT(AttachmentBinary, @expression))

ORDER BY ##ORDERBY##