Smartsite iXperion QuickSearch Smartlet
This Smartlet wraps the functionallity previously offered through the Smartsite iXperion Full Text Search Module.
The Smartlet consists of a SQL script and SXML logic. The script adds the needed objects (tables, stored procedures) to the database. The SXML logic adds a front-end with which the contents of the site can be searched. The functionality and presentation can be changed to fit your needs by means of altering the SXML logic.
The Smartlet uses the following database objects:
- ContentTypeField 'Searchable' (boolean)
Determines is the corresponding field is indexed.
- Table 'TsSearchGroups', CTFP 'SearchGroups' (text)
For now, only one search group is defined: 'Standard'.
- Table 'TsSearchGroupsCTypeFields'. Relation between SearchGroup and Contenttype (cascading delete).
- Stored procedure 'pr_TextSearch'. Creates internal datastructures and provides overview of the configuration.
After configuring the fields, and after changing them, the stored procedure 'pr_TextSearch' must be executed. This procedure updates the internal datastructures and returns an overview of the configuration.
Note: The SQL datatypes 'Text' en 'Image' are deprecated starting with SQL Server 2005 and can not be indexed by the full text search engine. Existing columns of these types must be converted to 'varchar(n)' or 'varchar(max)'.
Executing the SQL Script
The SQL script has it's own application page under the setup page. Whenever the setup page is rendered, queries are executed to check the database for the required tables, stored procedures, etc. If everything is in order, a green check mark is shown. The script can be executed directly from the 'Database objects' page. Normally the output of this page will be 'Done.'. If not, errors occured. In that case you best copy the complete script and run it directly form SQL Server Management Studio. A lot of 'PRINT' statements are present in the script. These should help you pinpoint the location at which the error occurs.
After executing the script, a full site reload (cms server and publication server) is needed.
Please make sure you have made a back-up of the database prior to executing the script.
Front-end
With this Smartlet you get a text box, and/or switch, contenttype filter list and pagesize inputs to ask a user for input. The results are presented in a pageable (ajax of course) list. Because of the Smartlet approach, all aspects of the form and/or results presentation can be altered to fit your (or your customers) needs. The Smartlet degrades gracefully in a scriptless environment. It then always shows the complete form and 'previous' and/or 'next' buttons (if applicable). In it's current form only one instance of the smartlet can be used per page.
Parameters
The table below gives an overview of the available parameters for the QuickSearch Smartlet.
| Name | Type | Default | Description |
|---|---|---|---|
| mode | string | search | The mode in which the Smartlet operates. Possible values are 'search' (form and results) or 'results' (no form). |
| terms | string | The terms to use in the search command | |
| showoptions | boolean | true | Show all the options in the form. Set to false to show a search box and button only. |
| showtype | boolean | true | Show the contenttype icon in front of a result. |
| maxresults | integer | 100 | Total number of results to show |
| pagesize | integer | 10 | Number of results per page. Possible values are 5, 10, 20 and 50 |
| filterlist | string | Comma seperated list of contenttypes code. The list is prepended with the value 'All types'. The filter allows the user to see only results of the selected content type* | |
| filter | string | Contenttype code for preselecting a row in the filterlist | |
| wildcards | integer | 1 | Possible values: 1 - append wildcard to every term entered; 0 - do not append wildcard, i.e. exact matches only |
| searchtype | integer | 0 | Possible values: 0 - AND search; All terms must be present in a result 1 - OR search; One or more terms are present in a result |
| folder | integer | 0 | Folder to restrict search command to (direct children). This parameter is not exposed in the search form. It can however be used in specific site building situations. |
| recursive | boolean | true | If true use hierarchy below folder to search. This parameter is not exposed in the search form. It can however be used in specific site building situations. |
*To overcome language problems, simply create values in the localization table for the contenttypes you want to present in the list. (i.e. CT_EVENT with localizations 'Event' and 'Evenement'. The form already places a locale.translate viper around each value in the filterlist.
Localization
All front-end strings can be placed in the localization table. English and Dutch translations are supplied in the form of SQL scripts. The localization script has it's own application page under the setup page. Whenever the setup page is rendered, queries are executed to check the localization table. If all strings are present, a green check mark is shown. The localization script can be executed directly from the 'Localization' page
