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 that upgrade to Sitefinity CMS 14.3 or above, 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 behaviour.

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 MVC 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 that: 

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

.Net Core Searc box widget configuration

You use the Search box widget to enable users to search for content on your website. For more information, see .Net Core 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 scopes dropdown select:
    • As set for the system. This is the default behavior of the widget and it follow the advanced settings configuration. For more information, see Advanced settings configuration.
    • All sites in the index. Select this option to show results from all sites in the index irrespective of the advanced settings configuration.
      Current site only. Select this option to show 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.

Web Security for Sitefinity Administrators

The free standalone Web Security lesson teaches administrators how to protect your websites and Sitefinity instance from external threats. Learn to 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?