Sitecore Search is an advanced content search feature that comes integrated with Sitecore XM Cloud, Sitecore XP, and Sitecore Headless CMS environments. It empowers organizations to deliver personalized, context-driven results across websites and applications. With support for Solr, Azure Search, and third-party providers like Coveo, Sitecore Search indexes and retrieves content efficiently based on metadata tags, templates, and search fields.
In a typical Sitecore architecture, search plays a key role in guiding user journeys and improving content discoverability. However, showing every piece of content—including irrelevant, outdated, or sensitive pages—can hinder performance and user experience. That’s where the exclusion mechanism becomes useful.
Certain types of pages on your website should not be surfaced in user search results. These might include internal-facing pages, temporary redirects, outdated product descriptions, or thank-you confirmation pages. Indexing such pages could lead to:
Irrelevant search results
Security vulnerabilities
Poor user experience
Increased maintenance overhead
By configuring Sitecore Search to respect an exclusion flag, you can keep your search index clean, focused, and optimized for high relevance.
After form submissions (like contact us or subscription forms), users are redirected to thank you pages. These pages contain no useful search content and shouldn’t appear in results.
Login, registration, or admin pages—often protected with authentication—don’t belong in the public-facing search index. Exposing them can cause confusion and create loopholes in security.
Continue reading about Sitecore Agency in Mecca with this link.
As businesses grow, some content becomes obsolete but still remains in the system. Keeping such legacy content in the search index can dilute important and up-to-date results.
Pages created for internal testing or staging environments can accidentally be published. Filtering these ensures that only production-ready content is indexed.
To enable content-level control over search exclusion, you need to create a checkbox field in Sitecore. This can be done in the Template Manager or Content Editor:
Open the template of the pages you want to manage.
Add a new field and name it ExcludeFromSearch.
Set its field type to Checkbox.
Save and publish the template.
This field provides a straightforward way for authors to decide which pages should be excluded from Sitecore Search.
Continue reading about Sitecore Agency Egypt: Top Development Companies You Can Trust with this link.
Make sure that templates for landing pages, confirmation screens, login pages, and outdated resources have this field. You can apply it through base templates for consistency.
Train content authors to check the “Exclude from Search” field for pages that should be hidden. This adds flexibility and control to content publishing workflows.
To make Sitecore aware of the new field during indexing, you must register a computed field. This allows Sitecore’s indexing engine to recognize and store the ExcludeFromSearch value.
Example of a computed field configuration:
<field fieldName=”exclude_from_search” storageType=“yes” indexType=”untokenized” >
Sitecore.ContentSearch.ComputedFields.ExcludeFromSearchField, MySitecoreProject
</field>
In your C# class:
public class ExcludeFromSearchField : IComputedIndexField
{
public string FieldName { get; set; }
public string ReturnType { get; set; }
public object ComputeFieldValue(IIndexable indexable)
{
var item = (SitecoreIndexableItem)indexable;
return item.Item[“ExcludeFromSearch“] == “1”;
}
}
Continue reading about Sitecore Agency in Jordan with this link.
Now update the search configuration to exclude items where exclude_from_search = true. This step depends on the search provider (Solr, Azure Search, or Coveo).
For LINQ-based search:
var results = context.GetQueryable<SearchResultItem>()
.Where(x => !x.ExcludeFromSearch);
Once everything is configured, rebuild your search indexes from the Control Panel. This will populate the new exclude_from_search field across indexed items.
When writing your search logic, add a filter to ignore items where the exclusion flag is set.
Example using LINQ:
var query = context.GetQueryable<SearchResultItem>()
.Where(item => !item.Fields[“exclude_from_search“].Equals(true));
For Solr or Azure Search, this filter can be added in query expressions.
Here’s a complete example for a custom search controller:
public ActionResult Search(string keyword)
{
var context = ContentSearchManager.GetIndex(“sitecore_web_index”).CreateSearchContext();
var results = context.GetQueryable<SearchResultItem>()
.Where(item => item.Title.Contains(keyword) && !item.ExcludeFromSearch)
.Take(20)
.ToList();
return View(results);
}
Continue reading about Sitecore Agency in Kuwait with this link.
Once implemented, validate by running search queries that would previously return excluded pages. If they no longer appear, your exclusion logic is working correctly.
Avoid bloated indexes by regularly auditing your content. Unpublish or archive unnecessary content and use the exclusion field consistently.
Maintain internal guidelines for content authors. Include rules such as:
Which pages should be excluded
How to mark them
When to update the field
Log which pages are excluded for future auditing. This can be useful in large-scale Sitecore implementations to ensure compliance and search optimization.
Use logging to verify exclusion logic:
if (item.ExcludeFromSearch)
{
Log.Info($”Page excluded from search: {item.Title}”, this);
}
Excluding pages from Sitecore Search involves four key steps:
Creating and assigning a Boolean exclusion field
Indexing this field via a computed field setup
Modifying search queries to respect the flag
Testing and documenting the process
A well-configured Sitecore Search boosts UX and site performance
Avoid indexing irrelevant or sensitive pages
Enable content authors to manage exclusion with ease
Keep documentation and logs to maintain governance
By implementing this exclusion model, Sitecore developers and marketers can work together to enhance the digital experience and maintain a search interface that’s both fast and relevant.
Continue reading about Top Sitecore Agency in USA with this link.
We are your Strategic IT Partner in development of reliable and scalable IT solutions for any OS, browser and device. We bring together deep industry expertise and the latest IT advancements to deliver custom solutions and products that perfectly fit the needs and behavior of your target audience.
Skype :: biztechnosys
AUS :: +61 4684 88455
INDIA :: +918035827097
Email :: info@biztechnosys.com
Copyright © 2012 – 2025 BIZTECHNOSYS. All Rights Reserved.