The Search template lets users search for content on your site. It can generate suggestions while a user is typing, "search instead" should no results be found, and allow users to refine their results with facets.
Page Title and Content
The page title and content, including inline elements, appear at the top of the page as per the Default template.
Related Content
Related assets, like media items, links and features, display as per the Default template.
The Search Field
In all themes the search field includes a text box and search button. In the article extras there are two fields for placeholder text. The "Search Bar" placeholder is used when the search appears in your site header or homepage (or anywhere else it may appear in your site theme). The "Search Template" placeholder is used for the search input field on the Search template itself. If left blank the placeholder is "Search..."
Several actions can trigger the search:
- Pressing the Enter key will perform a search based upon the current text in the input box
- Clicking the search button will perform a search based upon the current text in the input box
- A search suggestion can be selected by either clicking a suggestion or highlighting one using the keyboard arrow keys and pressing Enter. Selecting an article from the suggestion list will take you directly to that article. Selecting a media item will perform the search again, using the full title of that item.
Search Operators
By default, the Search template will return results containing any word entered into the text input box. For example, searching for example form will return all items that contain either the word example or the word form.
You can perform more advanced searches using search operators. The most important search operators are:
"" | Wrapping a search term in quotation marks will search for an exact phrase. Searching for "example form" will return items than contain the phrase example form. It will not return results containing form example. |
---|---|
NOT | Placing a minus symbol, or the word NOT, before a word will exclude items that include that word. For example, searching for example -form will return items that include the word example but not those that include the word form. Should an item include both example and form, it will be excluded. |
AND | Using AND will return items that include the words immediately before and after the word and. Searching for example and form will return items that include both the words example and form anywhere in their content. |
* | Using an asterisk will perform a wildcard search. Asterisks can be used as placeholders in exact phrases or and operations where a term is not known. |
Search Suggestions
The Search template can be set up to show search suggestions in the article extras.
Once three characters have been entered suggestions are displayed in a drop-down beneath the input box. As each character after the third is entered, the list updates with more accurate results. The list includes the four most likely items (either articles or media, depending upon the content that's been configured to return) based upon the current text in the box.
Search Results
Normally an article using the Search template does not display any results until a search has been performed. If facets have been configured the article will display a list of all items that match the defined facets, ie a search on the wildcard "*"
All search results obey article and media security, ie only items that the user has permission to see are returned.
Search Roots
In the article extras you can set the search to return articles, media, or both.
Content roots can also be set, limiting the articles and media items that are returned. If you don't set any content roots, all articles and media that the subsite itself has access to (see Subsite Group and User) will be searched.
Article roots restrict the search to the articles beneath them in the navigation tree (the root article itself is excluded). Care should be taken as "hidden" articles (articles beneath parent articles that have their display set to "no") will be returned in the search: articles in the "hidden" section are simply hidden from the site navigation menu, not the search. You can exclude individual articles from the search using their "search boost value" (see Article Search Optimisation in the article editor documentation).
Media roots let you restrict the search by media group and type. Selecting one or more groups will only return items in those groups. Selecting one or more media types (eg PDFs) will only return those media types in the results. Groups and types can be used in combination.
Search Instead For
If the search term returns no results, the Search template can be set up to perform a secondary search. This feature can be turned on or off in the article extras.
The new search term will be a word or phrase that is similar to the one entered by the user. Where an alternative search term has been used, a message will be shown in the following format:
Searching on <query> found no results. Searching instead for <suggestion>
Where <query> is the original query and <suggestion> is the alternative search term that that was used for the search.
Search Result Statistics
Once a search has been performed the following text appears below the search input.
Searching on "<keywords>" found <NumResults> results - Page <PageNum> of <TotalPages>
Where:
<keywords> = the keyword(s) used for the search
<NumResults> = the number of results returned
<PageNum> = the number of current page of results
<TotalPages> = the total number of result pages
If the results fit on a single page the text Page <PageNum> of <TotalPages> will be omitted.
Sorting
By default the search displays the most relevant results first. In the article extras you can enable sorting options by selecting them from the "Sort" field. The sorting option you set first will become the default.
The options are:
- Start (most recent)
- Start (oldest)
- Modified (most recent)
- Modified (oldest)
- Created (most recent)
- Created (oldest)
- Title (descending)
- Title (ascending)
You can pick as many sorting options as you like. The buttons appear in the order they are listed above. If you don't choose any options the buttons are hidden and the search displays the most relevant results first.
Pagination
The number of items per page is configurable in the article extras. Where there are more results than will fit on a single page, a page navigator is displayed beneath the search results. The behaviour of this navigator is the same as that described for the List template.
Article Results
By default, articles returned by the Search template display their title, the article URL, and a description, if available.
The title is the article heading text. Article alternate link text is not used. It acts as the link to the article.
The article URL includes the ID and heading, or friendly URL if the article has one. The article URL does not act as a link.
A description of the article appears beneath the article URL, using the following order of preference:
- Summary text (if available)
- Introductory text (if available)
- Body text (if available)
- Ellipses (should none of the above be available)
Article Views
Some templates, like Contact Directory, Classified and Blog have custom "views" when they appear in search results. This example shows the custom view of the Classified template when it appears in the search.
To enable custom views in the search results, change the article view in the search extras to "Custom". If your search returns media items, you cannot enable custom views.
If a template type doesn't have a custom view it will display its article heading and summary in a box, plus it's first related image if it has one. The image below shows an article using the Default template.
If you enable custom article views you can also set the number of columns (1-4) the results will appear in.
Media Results
Media items returned by the Search template follow the same style conventions as article items.
The top result in the example image shows a media item with a single component. The result is made up as follows:
- The title of the media item which acts as a link to that item
- The URL of the item
- The summary as indexed by the platform search engine. This includes keywords, the title, the description and related metadata values
The bottom result in the example image shows a media item with two components. The result is made up as follows:
- The title of the media item
- A list of components, made up of the component name and URL. The combined name and URL act as a link to that component
- The summary as indexed by the platform search engine. This includes keywords, the title, the description and related metadata values
Search Facets
Different facets can be set up in the Search template, allowing users to refine their results. Facets are organised into groups, the titles of which are content managed. Each group holds a particular facet type, one of:- Content Root (articles or media in a certain group or section of the site)
- Media Type (for example, PDFs, or Word documents)
- Metadata (items tagged with the selected metadata values)
- Template Type
- A custom SOLR query
- Date (created, last modified, display start, display end) which will appear as either a month or year facet, within a set range
- Metadata Property (automatically builds facets from all of the values of the selected property)
The names of most facets (excluding date and metadata property) are also content managed. After each facet, the number of results that match that facet is displayed in brackets.
As facets are selected they are added to the "You selected" panel. Individual facets can be deselected by clicking on them, or all facets can be removed by clicking "Clear all".
Facets only appear if there are results that include those facet types. For example, if you created a date range facet for content created before October 2005, and the search results only returned items created after that date, the facet would not appear. Similarly, if the search returns results that only match one facet in a given group, the group will not appear.
Selecting Facets
As facets are selected the list of results updates to only include items that match. The list of relevant facets will also update. For example, should facets exist for media types, created date, and metadata, and a user selects a metadata value that is not used by any media item, the media types facet group would disappear.
Selecting Multiple Facets
Most facets behave exclusively within their group. For example, selecting a facet from an "article root" group would display results from that root and hide the other "article root" facets (because an article can only be in one root).
Others, like metadata property and date range, behave inclusively, that is, you could select the date facet for December, and the facet for January, and the facet for February, returning a greater number of results as more are selected.
Inclusive | Exclusive |
---|---|
Metadata Property | Content Roots |
Dates | Media Type |
Metadata Value | |
Template Type |
Creating Facets
Facets are organised into groups. There are three types of group, and each group holds a different type of facet. You need to enter a name for all group types, which will appear above those facets on the search page.
Simple Facets
The simple facet group is a container that can hold any number of facets of any type, although it generally makes sense for all of the facets in one group to be of the same type.
The four types are CONTENTROOT, MEDIATYPE, METADATA, TEMPLATE and CUSTOMSOLRQUERY.
Article and Media Content Roots, Media Types, Template Types and Metadata Values
These facet types let you pick content, or types of content, that will act as facets for the search results.
An article root facet filters search results to articles beneath a particular article.
A media root facet filters search results to media items in the chosen group.
The media type facet filters search results to just that media type, for example, selecting a PDF facet would only display PDFs.
The template type filters results based on the type of template an article uses.
Metadata value facets filter results based upon items tagged with those values. Unlike the metadata property group described below, you are able to select exactly which values will be used, and they can come from a variety of different properties.
Once you've created a simple group, use the "Add facet" button to create the individual facets.
For example, this group has two article root facets, each corresponding to a different area of the site:
Custom SOLR Queries
The CUSTOMSOLRQUERY facet type provides a free-text area that allows you to enter a SOLR query in the same format as you would from the SOLR admin console. Building custom SOLR queries is beyond the scope of this documentation.
Dates Group
To add a date facet, click "Add group" and select DATES from the drop-down.
Select the dates between which you would like facets to be generated. If you'd like date facets to cover all of the content on your site, it's a good idea to set the "From" date to a time before content was created on your site, and the "To" date several years into the future (so that you don't have to keep rolling the end date forward).
The "Query Field" drop-down lets you choose whether articles and media are faceted based upon when they were created, when they were last updated, when they started to be displayed, or when they are set to stop being displayed.
"Facet Mode" sets whether the facets appear as months or as years.
For example, the following DATES group in iCM would create these facets on the site:
When a user selects a date, only the search results relevant to that month or year will be displayed. As more dates are selected, more results are shown.
Metadata Property
To add a metadata property group, click "Add group" and select METADATAPROPERTY from the drop-down.
Use the "Select" button to pick a metadata property.
The metadata property facet group generates facets automatically using the values of the chosen property, there's no need to manually add facets to the group.
For example, the following METADATAPROPERTY group in iCM would create these facets on the site:
The values of the "EventType" property appear as facets (as long as there are articles that are tagged with those values). When a user selects a facet, only results that are tagged with that value will be displayed. As more value facets are selected, more results are displayed.
Article Extras
Field Name | Type | Description |
---|---|---|
ITEMSPERPAGE | Number | The number of results to display per page |
SEARCHINGINSTEADFOR | Drop-down | Yes/No to enable search instead |
SUGGESTIONS | Drop-down | Yes/No to enable search suggestions |
SEARCHBARPLACEHOLDER | Text | Placeholder text for the search input when it appears around your site, eg in the header. Defaults to "Search..." |
SEARCHTEMPLATEPLACEHOLDER | Text | Placeholder text for the search input on the Search template. Defaults to "Search..." |
SORTORDERS | List Box | Select the sorting options that the user will e able to select. If none are selected results are ordered by relevance |
COLLECTIONS | Checkbox Group | Articles/Media - if checked will be searched |
VIEWNAME | Drop-down | How article results will be displayed. Other than the default (an empty value) the only option is "Custom" which will implement the custom search view of any templates in the results. These views are described in the various templates that have them |
COLUMNS | Number Input | The number of columns results are displayed in (only relevant if custom views are enabled) |
ROOTARTICLES | Asset Lookup (multiple articles) | The root articles that will return content in the search |
ROOTMEDIAGROUPS | Asset Lookup (multiple media groups) | The media groups that will return content in the search |
ROOTMEDIATYPES | Asset Lookup (multiple media types) | The media types that will return in the search |
Various facet fields | Various | All of the facet configuration is interdependent and held in a single layout field |