Reference library

Article number: 301019

Deploying an Indexed Search

Once created, an Indexed Search is deployed as a search form UI on a web page. It requires two elements.

Search Widget: The search widget can be added to a Page Layout, Content Layout, or a Variable Block.

Search Result Widget:  This can also be added to a Page Layout, Content Layout, or a Variable Block.

Search Widget Syntax

<sitekit:search id="Search1" class="Search" action="/search-results.htm" indexname="Search" labeltooltip=""

labeltext=" " textboxtooltip="" textboxtext="" buttontooltip="" buttontext="" />

Search Property values

  1. id sets html form element id.
  2. class sets html form element class.
  3. action sets html form element action. This is where the form is posted to.
  4. indexname specifies the search index to be searched.
  5. labeltooltip sets tooltip of label or in html label title.
  6. labeltext sets text of label or in html label value.
  7. textboxtooltip sets tooltip of text or in html input type text title.
  8. textboxtext sets text of textbox or in html input type text value.
  9. buttontooltip sets tooltip of button or in html input type submit title.
  10. buttontext sets text of button or in html submit type value.

Search Result Widget Syntax

<sitekit:searchresults id="SearchResults1" class="SearchResults" indexname="SiteSearch" show="all" partial="all" />

Search result attributes


Attribute Value

id

Sets html element id.

class

Sets html element class.

Indexname

Searches this index with term posted in corresponding search widget with the same index name.

show

summary, context, description, keywords, link, all, none.

partial (11.2)

none, all, partial

The show attribute

The show attribute can be set to a comma-separated list of selections, e.g.

<sitekit:searchresults id="SearchResults1" class="SearchResults" indexname="SiteSearch" show="summary, description, context" />

If no values are set it defaults to a combination of context and link

Show attribute values


Value Output

context  

Attempts to identify the most relevant content from page title, keywords, metadata and content text

summary

Page summary set in page properties (Standard tab)

description

Metadata description

keywords Metadata keywords
link Page path
all All of the above

none

None of the above

The partial attribute

(11.2) The partial attribute allows partial words to be included in the search results.

Partial attribute values


Value Output

none

All terms must match exact words

prefix

Terms can match the beginnings of words

all

Terms can appear anywhere in words

Example

If search index text contains: 'Right Said Fred'.

  • Searching for: 'ight aid' will only return results with partial set to 'all'.
  • Searching for 'righ sai' will only return results with partial set to 'all' or 'prefix'.
  • Searching for 'right said' will return results with partial set to 'all', 'prefix' or 'none'.

Note: 'partial' can also be passed as a querystring parameter or posted field if the search form is hard-coded rather than using the xml sniplet.


Search term highlighting

Search results now show the context centred around the position of the first matching term in the indexed text and a span with class SKSearchTerm is inserted around each instance of a term in the context to allow it to be styled if necessary.

<span class="SKSearchTerm">found phrase</span>

An elipsis (...) is shown where the context has been trimmed before or after the search term (10.4)

Related questions