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.

Track and view statistics

Search Statistics provides an API for tracking searches, 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 total number of search results returned and how many should show on the search page with pagination.

Highlight search results

Highlighting matching search keywords is helpful when evaluating search results. You can request highlights 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 you can add to a page and reuse on the website. Blocks do not have a URL and are not indexed because blocks display in a page context. However, there are methods to achieve content area indexing and control the indexing of specific block types.

Filters and facets

Queries and filters make up search requests, and filtering narrows search results. Use facets to present 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. You can combine facets with filters.

Best bets

Best bets let search administrators promote selected content from the Optimizely Search & Navigation admin view. Best bets display at the top of the search results as they apply higher boosting. You can add best bets through the ApplyBestBets extension method using Unified Search or 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 with 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)...