Kentico CMS 6.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!  

Document attachments uploaded to the database can be searched as well. This is done by using the Microsoft SQL Server full‑text search. You need to have your SQL server configured properly as described in the Installation and deployment -> Additional configuration tasks -> Configuration of full-text search in files chapter in order for attachment searching to be functional.

 

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

 

Property Name

Description

Search in attachments

If enabled, document attachments will be searched.

WHERE condition

WHERE condition used to limit the scope of the attachment search for this web part. In addition to specifying which documents should have their attachments searched, you may 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 used to determine the order of documents retrieved by the attachment search in the results.

 

When a search is performed and a match is found in the attachment of a document, the given document is added to the returned results. These results are always interlaced with the other results provided by the specified smart search index(es). This is by design and cannot be modified.

 

Because the attachment search is performed by the SQL server, it is not affected by the settings and restrictions of the used index(es). If you wish to limit the attachment search, it is necessary to 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 would 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 will only return documents if they are directly connected to the matching attachment through one of the following methods:

 

The attachment files are added to the document using fields that have their Attribute type set to File or Document attachments in the document type definition.

The attachments are uploaded in CMS Desk via the Properties -> Attachments dialog of the given document.