Filtering of search results in a common index by site

Overview

By default, Sitefinity CMS shows all results from the index that has been designated in your Search box. This means that in a multisite environment, if you only want to have a single index for all sites in your project, the results shown would be from all sites. And if you want to have individual search results for sites, you must create an index for each site. Depending on the number of sites you have, this could result in increased hosting costs and difficulty to manage your search indexes.  

If you want indexes to show results just from the current site only, you can configure Sitefinity CMS and your Search box widget to show results from the currently used site only even if it shares an index with other sites.

IMPORTANT: For projects upgraded to Sitefinity CMS 14.3 or higher, your indexes must be deleted and created anew if you want to use this feature. Just reindexing is not sufficient.  

Advanced settings configuration

You can enable this filtering of search results in a common index per site at system level or per widget.  

To configure the filtering at system level: 

  1. Navigate to Administration » Settings » Advanced » Search
  2. Disable the Search in all sites in an index option. 
  3. Click Save changes.

The configuration in advanced settings affects the whole project. Each Search box widget can override this configuration, providing ability to instruct specific sites to have different behavior.

MVC Search box widget configuration

You use the Search box widget to enable users to search for content on your website. For more information, see Search box widget

You can configure the Search box widget to display results from all sites in an index or only for the current site irrespective of the advanced setting configuration. 

To do that, perform the following: 

  1. Drag and drop the Search box widget on a page. 
  2. In the upper-right corner of the widget, click Edit to open the designer of the Search box widget. 
  3. Click Advanced to open the advanced setting configuration. 
  4. Click Model
  5. Set a value for the SearchInAllSitesInTheIndex option. 
    Leaving the text box empty means that the widget behaves as instructed in the advanced settings.
    • To display results for the current site only, irrespective of your advanced settings configuration, set it to False
    • To display results for all sites, irrespective of your advanced settings configuration, set it to True

    NOTE: You must only use this option for filtering the data that comes from the search service. If you want the data in the index to be from a particular site and you want to prevent queries to it, use the index creation menu where you specify the scope of the search index.

  6. Click Save changes.

ASP.NET Core Search box widget configuration

You use the Search box widget to enable users to search for content on your website. For more information, see Search box widget

You can configure the Search box widget to show results from all sites in an index or only for the current site irrespective of the advanced setting configuration. 

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 (Advanced settings) in the upper-right corner of the Search box page to open the advanced settings.
  5. In Search scope dropdown, select:
    • As set for the system
      This is the default behavior of the widget and it follow the advanced settings configuration.
    • All sites in the index
      Select this option to display results from all sites in the index irrespective of the advanced settings configuration.
    • Current site only
      Select this option to display results from the current site only irrespective of the advanced settings configuration.
  6. Click Save.



Increase your Sitefinity skills by signing up for our free trainings. Get Sitefinity-certified at Progress Education Community to boost your credentials.

Get started with Integration Hub | Sitefinity Cloud | Sitefinity SaaS

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 yor 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 .NET Core and leverage its decoupled architecture and new way of coding against the platform.

Was this article helpful?