Speed up widget development with Sitefinity MCP server. Learn more...

Search box widget

Overview

You use the built-in ASP.NET Core search widgets to display a search box and search results on your website. You use the Search box and Search results widgets to enable the users of your website to search for content.

PREREQUISITES: You created at least one search index. For more information, see Create search indexes.

Place the widget on the page

You can place a Search box widget only inside a Section widget.
To do this, perform the following:

  1. Inside a column from the Section widget, click Add widget here…
  2. Select the Navigation & Search tab.
  3. Click the SEARCH BOX widget.
    The widget is placed inside the selected column of the Section widget.
  4. Click Set where to search.

Search setup

  1. In Specify content to search in, select the search index that you want to use for this search box.
    The search index is a predefined set of search content. For example, you can create a search index that contains all news items. When a user enters a search word, it is applied to all news items on your website.

    NOTE: ASP.NET Core search widget does not search the HTML of the page.

  2. Under Search results page, click Plus sign (Select page) and select a page from your website that will display the search results.

    NOTE: You can select the page where the Search box is located, as well as any other page.

    IMPORTANT: You must add the ASP.NET Core Search results widget to the page that will display the search results.

  3. In Display suggestions after typing..., select the minimum number of characters that the user must enter, after the search box displays search result suggestions.
    Select between the predefined values of None, 2, 3, 4.

    NOTE: In the advanced settings, you can configure which fields to use for the search suggestions.

Boost search results

PREREQUISITES: You see the Boost search results section only when you are using Azure Search.

You use the Boost search results section to configure additional parameters for Azure Search:

  • Scoring profile
    Scoring profiles are part of the search index and consist of weighted fields, functions, and parameters. 
    Use scoring profiles to boost search results by customizing the way different fields are ranked.
  • Scoring parameters
    Scoring parameters are part of the scoring functions within a scoring profile.
    Add scoring parameters to boost content to appear higher in the search results by specifying the parameter's name and value.
You manage the scoring profiles and parameters in the Azure portal.
For more information, see Add scoring profiles to a search index.

Display settings

In Display setting section, you can do the following:

  • Change the template
    To change the template that the Search box widget uses, select the new template in the Search box template dropdown box.

    You must first have created a custom template.
    For more information, see ASP.NET Core pages and templates.

  • Configure the widget margins
    In Margins, you can choose the margins between the text and the column where it is placed.
    Choose from the predefined values of none, small, medium, or large.

Save your changes.

Advanced widget settings

To open the advanced settings, in the upper-right corner of the Search box page, click Settings (Advanced settings).

  • In Label, you can enter a specific name for this widget.
    This name will be displayed in:
    • The page editor as a label for the widget
    • In the treeview with the page structure in the right pane of the page editor.
  • In CSS class, you can enter individual CSS class for the Search box widget.
  • In Suggestion fields, you can enter the fields that the search suggestion will use to suggest search results while the user types in the search box.

    NOTE: These fields must be included in the search index that you chose for this search box.
    For more information, see Create search indexes.

  • In Display on public site for…, you can select which user role can see the widget content when viewing the public site.
  • In Search scope, select whether to search in all sites in the index, this site only, or what is set in the system. To see how this is set for the system, go to Administration » Settings » Advanced » Search and find the setting Search in all sites in an index.
  • In Filter expressions, you can use filter expressions to filter the search results displayed in the frontend. This is compatible with search facets. For more information, see Filter expressions

Filter expressions

NOTE: This feature is available as of Sitefinity CMS 15.4.8631 and works only with Azure AI Search and Elasticsearch.  It is compatible with search facets: search facets are applied on the filtered results. For more information about search facets, see Search facets

In Filter expressions, you can create a custom filter by manually entering a filter expression in JSON format. This filter expression is a serialized hierarchical JSON structure that limits the content the Search box widget includes in its search results.

This filter accepts the following operators:

  • "eq" – equals
  • "ne" – does not equal
  • "gt" – greater than (for numbers)
  • "lt" – less than (for numbers)
  • "ge" – greater than or equal (for numbers)
  • "le" – less than or equal (for numbers)
  • "any+or" – contains any of the collection
  • "any+and" – contains all of the collection
  • "not+(any+or)" – does not contain any of the collection
  • "startswith" – starts with (for strings)
  • "not+(startswith)" – does not start with (for strings)

The above filters have the following properties:

  • FieldName maps to the name of the field in the search index.
  • Operator maps to the logical operator.
  • FieldValue maps to the value with which to execute the logical operation.

NOTE: The fields you use in filter expressions must be included in the search index that you chose for this search box.

Filter examples

Basic filter by content type

Only returns search results whose ContentType matches a specific type. Use this when the search box should surface only a single content type, such as news articles.

Filter by URL prefix

Limits results to content whose URL starts with /blog. Ideal for section-scoped search on a multi-section site.

Exclude a URL subtree

Excludes all content under /internal from appearing in search results.

Filter by numeric value

Returns only items with a price greater than zero. Useful for product catalogs where free/unpublished items should be hidden.

Boolean filter

Restricts search to featured content only.

Match and of several values

Returns items in any of the three STEM categories.

Filter by tag (collection field)

Matches items whose Tags collection contains the value breaking-news. Works with choice fields, classification fields, and any multi-value property.

Exclude a tag

Excludes items tagged as archived from results.

Date range filter

Scopes search to content published in 2026 only. The date value must be in ISO format. Supported formats include:

  • yyyy-MM-dd'T'HH:mm:ss.fffK
  • yyyy-MM-dd'T'HH:mm:ssK
  • yyyy-MM-dd'T'HH:mm:ss'Z'
  • yyyy-MM-dd
Complex filter (AND / OR)

Use a complex filter to combine multiple conditions. The complex filter is recursive and can contain child complex filters. The Operator property can be "AND" or "OR", which determines how the child filters are combined.

Example – AND: both conditions must be true:

Returns only English news articles.

Example – OR nested inside AND: items must match the outer condition and at least one inner condition:

Returns only products under /products that belong to the Hardware or Accessories category.

Complex nesting

A real-world e-commerce scenario: search only shows featured, premium-priced items that are tagged "premium" but not "archived".

Labels & Messages

In the Labels & Messages section, you can do the following:

  • In Search box placeholder text, you can enter some text to guide the user that this is a search box.
    For example, you can enter Search….This text is only guidance for the user and is not submitted as a search term.
  • In Search button, enter the label for the search button that the user clicks to submit the search keyword.

Save your changes.

NEW TO SITEFINITY?

Want to learn more?

Enhance your Sitefinity skills by enrolling in free training sessions. Become Sitefinity certified through Progress Education Community to strengthen your professional credentials.

Get started with Integration Hub | Sitefinity Cloud

This free lesson teaches administrators, marketers, and other business professionals how to use the Integration hub service to create automated workflows between Sitefinity and other business systems.

Web Security for Sitefinity Administrators

This free lesson teaches administrators the basics about protecting your Sitefinity instance and its sites from external threats. Configure HTTPS, SSL, allow lists for trusted sites, and cookie security, among others.

Foundations of Sitefinity ASP.NET Core Development

The free on-demand video course teaches developers how to use Sitefinity ASP.NET Core and take advantage of its decoupled architecture and modern development model.

Tags

ASP.NET Core

Was this article helpful?

Next article

Search results widget