Search Results Page

This page is defined by the /pages/searchResults.ftl template in the portal theme. The search results page is meant to show the results of a query, and is bound to the URL path /portalUrlPath/search.

This page is populated with search results from the following query parameters:

escape
Either true or false. Specifies whether special query characters in the term should be escaped when executing the query. The default is false. See for details of reserved search characters.
facet
A metadata field to use as a search facet. If not specified, the search facets configured for the portal are used. See the Titania Delivery Administrative Guide for details on configuring a portal's default search facets. This parameter may be specified multiple times to specify multiple metadata fields to use as facets.
filter
A secondary search query to use to filter the available documents that should be included in the results. The same results could be achieved by adding additional criteria to the term, but there are performance benefits to using a separate filter parameter, especially when the same filter may be reused for multiple searches.
groupBy
The property for grouping results. Default is itemKey.
groupSize
The maximum number of contextualized DITA topics to include in result groupings. The default is 5.
highlightSize
The maximum number of characters to include in text snippets containing matching text. The default is 300.
maxFacetValues
The maximum number of facet values to include in the search results. The default is 10.
n
The number of search results to return per page. If not specified, the default is 10.
page
The zero-based index of the page to view. The default is 0.
portalContent
Portals can generate files using the siteData interface. This parameter specifies if and how content in that project should be included in the search. The valid values are:
exclude
Portal-generated content is excluded. This is the default.
include
Portal-generated content is included, along with other content available through the portal.
only
Only portal-generated content will be included in the results.
sortBy
The property name or names by which to sort the results. (All metadata values are indexed as keywords, and must be named with '_md' suffix: for example, sortBy=title_md.) Multiple names may be specified, separated by spaces or commas (URL-encoded as necessary). Multiple sortBy parameters may be included, but since the order of parameter processing is not guaranteed to be consistent, it is advisable to use only one sortBy parameter if corresponding sortDirections are specified.
Note: Sort keys given in the sortBy parameter will be used before the default "relevance" (as determined by the search engine) is applied. So the top items in the result list might not be the "most relevant" based on the search term.
sortDirection
Specify the sort directions corresponding to each sortBy field. If the list of sort directions is empty or shorter than the list of sortBy fields, the default order is ASC. Values may be either ASC or DESC (case-insensitive) to specify the sort direction as ascending or descending. Multiple sortDirection parameters may be included, but since the order of parameter processing is not guaranteed to be consistent, it is advisable to use only one sortDirection parameter (with multiple values, if necessary).
startAfter
For programmatic use only, this should be an object value from the SearchResultsPage startNextAfter property.
term
The search query.

Additionally, any number of metadata filters can be supplied, each in the format: f.[metadataName]_md. All parameters are optional but if a term parameter is not supplied the search results will be empty.

For example, assume the search page is requested with the following URL query string: ?term=Titania&n=5&page=1&f.format_md=dita. The page would be populated with data containing up to five search results of the second page (remember that the page param is zero-indexed) of results that match the search term Titania that have format metadata with a value of dita.

  • Search results for the word "Titania"
  • Up to five results
  • Starting with the sixth result, because we requested the second page (because the page parameter is zero-indexed).

Data Model

In addition to the common properties, this page has access to the following:

filterParams
A string containing the URL parameters for the metadata filters being applied to the search. This is a convenience property that could be constructed manually from the filters data structure. This property can be used to easily construct URLs in paginated search result lists.
filters

A hash. The keys of the hash are the metadata names being used to filter results. Each keyed entry is an array of the values for that metadata name specified by the user for filtering.

For example, if a user filters on a metadata named "foo" using values "abc" and "xyz", the ${filters} hash would look like this:

{
  foo: ['abc', 'xyz']
}
result
A containing the set of results to display, grouped by context, represented by objects.
sortBy
Sequence or null. If sortBy names were given, this will be a sequence of the given sortBy field names.
sortDirection
Sequence or null. If sortDirection parameter was given, this will be the sequence of values specified.
term
The search term entered by the user.