HomeDev GuideAPI Reference
Dev GuideAPI ReferenceUser GuideGitHubNuGetDev CommunitySubmit a ticketLog In
GitHubNuGetDev CommunitySubmit a ticket

Add search functionality

Describes additional Optimizely Search & Navigation-based search functionality that you can add.

This step assumes that you have a working website with Optimizely Search & Navigation and basic search functionality installed.

📘

Note

You need to enable features like statistics, Best bets, and synonyms, since they are not enabled by default.

Statistics tracking and viewing

Search Statistics provides an API for tracking searches and retrieving their statistical data. The aggregated statistics are also used for features like spelling suggestions and related queries.

If you are using Unified Search, add a Track statement to a search query to enable the accumulation of statistics.

Pagination

The default number of returned search results is limited to 10. Using the Skip and Take methods, you can override this and define the number of search results that should be returned in total and on the search page with pagination.

Highlight search results

Highlighting matching search keywords is helpful when evaluating search results. Highlights can be requested as part of projection expressions passed to the Select method. You can also use Unified Search to register a highlighted excerpt for a specific document type.

Search in blocks

Blocks are smaller content items that can be added to a page and reused on the website. Because blocks must be shown in page context, they do not have a URL and are not indexed by default. However, there are methods to achieve content area indexing and control the indexing of specific block types.

Filters and facets

Search requests are made up of queries and filters, and filtering is applied to narrow search results. Facets are used for presenting aggregated data based on a search query. When searching a product catalog, you can, for instance, let the website visitor restrict results based on product types or price ranges. Facets can be used in combination with filters.

Best bets

Best bets allow search administrators to promote selected content from the Optimizely Search & Navigation admin view. Bets bets display at the top of the search results, as higher boosting is applied to them. You can add best bets through the ApplyBestBets extension method using Unified Search, or by applying the method to indexed arbitrary types.

Synonyms

Synonyms are useful when you want the search to cover more phrases and return more relevant search hits. Also, visitors may use different terms to describe the same content. Add synonyms to search results with the UsingSynonyms extension method.

Diacritic characters

A diacritic character is a symbol added to a letter to change the sound values of that letter, for example, å, ä, ö. When submitting a free text search that contains diacritic characters, Optimizely Search & Navigation results include the diacritic and non-diacritic versions of the same character. For instance, the free text search 'Ånge' returns Ange, Änge, etc. You can configure the search to return results that include only the submitted diacritic characters.

  1. When you create the Optimizely Search & Navigation index, include the language that provides the diacritic character (for example, Swedish).
  2. Add that language to the search query. For example:
(SearchClient.Instance.Search<PageData>(Language.Swedish)...