Create New Templates

NOTICE: This document is in the process of updating it to reflect SearchBoost 3.

The true customization power lies in the XSL based templates.  They allow you to build any kind of layout you can imagine. To create your own templates we recommend that you become familiar with CSS, HTML and XSL.

The first thing you need to know before creating your own templates, is the 
structure of the XML used to transform the XSL template. Luckily, Search Boost allows you to stay in control while implementing the design by giving you view access to the underlying XML document. 

Figure 1: General Settings Dialog Box
To view the underlying XML document,
  1. Go to Search Boost Administration Console by selecting the Manage > Search Settings options from the Search Input box in the Search Boost portal.

  2. Locate and click the General Settings link in the left pane. This will open the General Settings dialog box.

  3. Locate and select the DEBUG: Show XML option, identified on Figure 1.

  4. Save the dialog and return to the portal by clicking Back to Portal, located in the menu bar.

  5. Locate and click the DEBUG: Show XML link under the Input module displayed below.
    • Important: The link only appears in the Search Input box before a search. When the search is performed you will then see the link in the Search Results box.

      Figure 2: Displays DEBUG: Show XML link


      • Note that the Debug: Show XML link is visible to all users.  This shows what the XML contains for different users. This means that you can use this function for debugging (especially for debugging results).

Search Input Templates


Search Boost reads the main.xsl file for the template you specified under the UI Settings tab and transforms it to following XML document displayed in Figure 3.

Figure 3: Displays XML Tags for Search Input


The following bullet list provides a definition for each XML tag specified in the XML code in Figure 3.
  • Root Node <input>
    • instanceId specifies the Module Id or Skin Object Control Id.
    • rootId specifies the root id for the Search Input module.
    • isModule is true or false depends if the instance is a module or a Skin Object.
    • isAdmin is true of false depends if the current user is an administrator.
    • sbManageURL specifies the URL for the Search Boost Administration Console.
    • init specifies the Initial text for the Input search box. This could be empty text or user inputted text.
    • empty specifies the text for the empty search box.
    • webroot specifies the root for the website. This is always empty except when the website runs in virtual directory.
    • sbroot specifies the root element for /DesktopModules/DnnSharp/SearchBoost.
    • fn-search specifies the name of the javascript that triggers the search.
    • apipath specifies the URL for Search Boost Administration..
    • requirekeywords is true or false depends if the instance require keywords.
    • contentfilters may contain search filters. This is empty if no filters are specified.

Edit Search Input Template

To change the appearance of the Search Input Template:
  1. Click on Manage on the Search Input module.
  2. Then select Search Settings.
  3. In the Search Boost Control Panel, click the UI Settings Tab.
  4. Then click on the Template Search Input Box drop down box and select the template.
  5. Then Scroll down and click the Save UI Settings button.
Figure 4: Identifies UI Settings and Template for Search Input Box

Search Results Templates


Respectively, the XML used to transform the templates for search boxes look like the following XML code in Figure 6. You can view the XML after a search is performed by clicking on the DEBUG: Show XML below the search results, displayed in Figure 5.

Figure 5: Displays DEBUG: Show XML link in Search Results


When you click on the DEBUG: Show XML link, a window with XML code appears. In Figure 6 for example, the XML tags specifies details for the search term - "content".

Figure 6: Displays XML Tags for Search Results

<?xml version="1.0" encoding="utf-8"?>
<search>
  <summary>
    <term>content</term>
    <resultcount>1</resultcount>
    <first_result>1</first_result>
    <last_result>1</last_result>
    <pagesize>10</pagesize>
    <pagecount>1</pagecount>
    <activepage>1</activepage>
    <locale>en-US</locale>
    <apipath>/DesktopModules/SearchBoost/AdminApi.aspx</apipath>
    <logid>41-9qzpc6sddtz3vqsy</logid>
    <social />
    <morelikethis>
      <baseurl>/SearchBoost_Page1.aspx?sb-search=content&sb-inst=409&sb-logid=41-9qzpc6sddtz3vqsy</baseurl>
    </morelikethis>
    <pages>
      <p ipage="1">/SearchBoost_Page1.aspx?sb-search=content&sb-inst=409&sb-logid=41-9qzpc6sddtz3vqsy&sb-page=1</p>
    </pages>
    <facets />
    <execution_time>0.16</execution_time>
  </summary>
  <results>
    <result>
      <author>4</author>
      <author_name />
      <description> a <span class='highlight'>Content</span> Management System? <span class='highlight'>Content</span> Management Systems implement features to store, manage and retrieve data efficiently. Some systems are simple while others are complex, but carry similar features. The three main CMS types are Web <span class='highlight'>Content</span> Management Systems, Enterprise <span class='highlight'>Content</span> Management Systems and Component <span class='highlight'>Content</span> Management Systems. ...</description>
      <module_id>413</module_id>
      <portal_id>0</portal_id>
      <pubdate>7/29/2012</pubdate>
      <relevance>1000</relevance>
      <docid>0</docid>
      <orderindex>1</orderindex>
      <type>mod</type>
      <subtype>DNN_HTML</subtype>
      <target>_self</target>
      <tab_id>83</tab_id>
      <tab_name>CMS</tab_name>
      <tab_title>Content Management Systems</tab_title>
      <mod_title>CMS</mod_title>
      <title>CMS</title>
      <url>http://dnn614.dev2.dnnsharp.com/CMS.aspx</url>
      <plainurl>http://dnn614.dev2.dnnsharp.com/CMS.aspx</plainurl>
      <ukey>nCbXhUouItH60eQInjLdRPblObmUt+kyVrfuyMr2qMPSIgdbo7Rg1kEBdo1480os</ukey>
      <urlfwd>/DesktopModules/SearchBoost/UrlFwd.ashx?url=http%3a%2f%2fdnn614.dev2.dnnsharp.com%2fCMS.aspx&ukey=nCbXhUouItH60eQInjLdRPblObmUt%2bkyVrfuyMr2qMPSIgdbo7Rg1kEBdo1480os&logid=41-9qzpc6sddtz3vqsy</urlfwd>
      <data />
    </result>
  </results>
</search>

A definition for each XML tag in Figure 6 are specified below.
  • search is the Root Node.

    • summary is a node that contains meta data about the search.
      • term specifies the terms that were searched.
      • resultcount is the number of results returned by the search.
      • first_result is the absolute index of the first result in the list.
      • last_result is the absolute index of the last result in the list.
      • pagesize tells how many results fit on a page (this is configured in UI Settings).
      • pagecount  calculates and determine the total number of pages for a given page size.
      • activepage tells the index (starting from 1) of the current page.
      • locale tells current location.
      • apipath is the root of the website (this is always empty other than when the website runs in virtual directory).
      • logid is the id used to identify that specific search instance.
      • social
      • morelikethis is a node that contains the base url for the search page.
        • baseurl is the url for the search page.
      • pages is a node that contains the page address of the search.
      • execution_time measures the elapse time from when Search Boost starts the search until the XML. object is created. Note that it does not measure how much time it takes afterwards to transform the XML or the time other components on the page takes to complete their execution.

    • results is the node that contains the list of results (the node below repeats for each result).
      • result is the root node containing search results information.
        • author is the ID of the User that published the content.
        • author_name is the name of the User that published the content.
        • description is a summary of the search result.
        • original_description is a summary of the search result that exist in the index, before any logic is applied (such as the highlighter or stripping it to a certain length). This field was added in 2.9.106
        • module_id is the module the result came from.
        • portal id is the ID of the portal containing the module where the content originated.
        • pubdate is the date when the content was published.
        • relevance is the relevance returned by the DNN Search Provider.
        • docid
        • orderindex
        • type is the result type that can be page or document (when the result comes from a file).
        • subtype is for modules. This is always portal for documents and this is the extension for the file (for example pdf, doc, etc.)
        • target determines the browser window that the result should be opened in.
        • tab_id is the id of the page containing the module.
        • tab_name is the name of the page containing the module.
        • tab_title is the title of the page containing the module.
        • mod_title
        • title is the title of the page.
        • url is the URL of the page containing the module that generated the result.
        • plainurl
        • ukey
        • urlfwd
        • data
        • occurrences specifies how many times the result has been found inside this specific module.

      • result is the next result.
        •  . . .

Edit Search Results Template

To change the appearance of the Search Input Template:
  1. Click on Manage on the Search Input module.
  2. Then select Search Settings.
  3. In the Search Boost Control Panel, click the UI Settings Tab.
  4. Then click on the Template Search Results Box drop down box and select the template.
    • There are actually two options for Search Results.
  5. Then Scroll down and click the Save UI Settings button.

Additional Notes


Here are some more tips & tricks that will help you:
  • It is best that you start from an existing template (copy/paste). Modifying an existing pre-built template will put you in the position to lose all your changes on the next upgrade.

  • Do not put spaces or other non-standard characters in the template name (we recommend only a to z and the minus sign).  This is to meet the strictest requirements when it comes to forming URLs for template resources.

  • Take a look at how existing templates are built; an example is worth a thousand words.

  • Note how each template have a distinct root CSS class. Although we recommend this practice, it is not required if you will never have the two search boxes on the same page because they only collide at that point.