Kentico CMS 7.0 Developer's Guide

Searching attachments

Searching attachments

Previous topic Next topic Mail us feedback on this topic!  

Searching attachments

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

Users can search through the content of attachment files uploaded to the database. The system searches attachments using the Microsoft SQL Server full‑text search.

 

Note: You need to have your SQL server configured to support full-text search in files.

 

Once you have the SQL server configured, enable attachment searching through the following properties of the Smart search dialog with results or Smart search results web part:

 

Property Name

Description

Search in attachments

If enabled, the web part searches document attachments.

WHERE condition

WHERE condition used to limit the scope of the attachment search for the web part. In addition to specifying which documents have their attachments searched, you can also use the columns of the CMS_Attachment table to search only attachments of a specific type, for example:

 

AttachmentExtension = '.txt'

 

ORDER BY expression

ORDER BY expression that determines the order of documents retrieved by the attachment search in the results.

 

When users perform a search and the system finds a match in the attachment of a document, the given document is added to the search results. The attachment results are always interlaced with the other results provided by the specified smart search indexes. This behavior is by design and cannot be modified.

 

The attachment search is performed by the SQL server, so it is not affected by the settings and restrictions of the used search indexes. To limit the attachment search scope, enter an appropriate value into the WHERE condition property of the used web part. For example, if you have a search results web part using a document index that is limited to the /News/% section of your website, you need to add the following WHERE condition to ensure that the attachment search is also restricted to these documents: NodeAliasPath LIKE '/News/%'

 

 

InfoBox_Note

 

Please note

 

The search only returns documents if they are directly connected to the matching attachment through one of the following methods:

 

Attachment files added to documents through fields that have their Field type set to File or Document attachments in the document type definition.

Attachments uploaded in CMS Desk on the Properties -> Attachments tab of documents.