Vulnerability in EPiServer.Forms

Try our conversational search powered by Generative AI!

Exclude pages from Search



I have a content Search in my code. But my certain Page Types are like System pages just for display of results. The only diffrenec in my code  between other pages and system pages are that the file name in create page type is  under the system folder in my code. How do I exclude them from search.??

Nov 23, 2010 5:40

Others might have better ideas, but off the top of my head...

I think you'd need to exclude them with critieria. Create a boolean property called "Exclude from Search" (or use the existing "Exclude from Menus") and add a criteria element to only match on those where this isn't checked.

For files, move the non-searchable files to a separate VPP and don't include it in the SearchLocations property.


Nov 23, 2010 5:54

Hi, thanks for the reply

All  my pages are of diffrent type and so i have to create creteria for all the pages .How do I map this creteria with my search?

Nov 23, 2010 6:30

You'll need to create that same property (named the same) on each Page Type, yes.  Then, do something like this:

<EPiServer:SearchDataSource PageLink="<%# PageReference.StartPage %>" runat="server">
    <EPiServer:PropertyCriteriaControl Condition="Equal" Type="Boolean" Name="ExcludeFromSearch" Value="False" Required="true" runat="server" />

I also just noticed that the SearchDataSource has a property called "EnableVisibleInMenu".  You could use this to exclude pages where "Show in Menus" is not checked.  That might be an easy way to filter out non-searchable pages.

Nov 23, 2010 6:47


I have creted a property in my page type "selected/not selected" with same name. Now when i am searching any text in my text box  nothing is showing up in my search.

Nov 23, 2010 8:11

Replace Value="False" with IsNull="True". And use a Dynamic Property instead of one for each page.

BR Jens

Dec 16, 2011 10:54

You could also use something like this

            // Exclude the following page types
            foreach (PageType pageType in Constants.ExcludedPageTypes.Search)
                FilterCompareTo pageTypeComparer = new FilterCompareTo("PageTypeID", pageType.ID.ToString())
                                                       {Condition = CompareCondition.NotEqual};

            // Remove all pages that are set to be hidden from the search
            new FilterCompareTo("HideFromSearch", null).Filter(e.Pages);

The above will filter out pages depending on properties also a set number of pagetypes you do not want to show

I just created a FilterMethod and passed this into the SearchDataSource :

searchDataSource.Filter += FilterSearchResults;

Dec 16, 2011 12:05
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.