Group search results by custom content type category


I have implemened search for my custom content type:

SearchIndexDocument doc = Apis.Get<ISearchIndexing>().NewDocument(roadTestItem.ContentId, roadTestItem.ContentTypeId,
    RoadTestConstants.RoadTestItemName, roadTestItem.Url, roadTestItem.HtmlName("web"), roadTestItem.HtmlDescription("web"));
doc.AddField(searchIndexing.Constants.IsContent, true.ToString());
doc.AddField(searchIndexing.Constants.ContentID, roadTestItem.ContentId.ToString());
doc.AddField(searchIndexing.Constants.Date, searchIndexing.FormatDate(roadTestItem.CreatedDate));
doc.AddField(searchIndexing.Constants.CollapseField, RoadTestConstants.RoadTestItemNames + ":" + roadTestItem.Name);
doc.AddField(searchIndexing.Constants.Category, RoadTestConstants.RoadTestItemNames);
doc.AddField(searchIndexing.Constants.ApplicationType, RoadTestConstants.RoadTestItemApplicationName);


but in search results I still see all my contents in the "All" tab instead of some category:

Can anyone suggest me?

[edited by: Iurii Luzan at 1:30 PM (GMT 0) on Fri, Jun 11 2021]
  • Those filters are defined by  ISearchCategories Plugin Type .  You will need to implement that interface and add your new category.  Then when indexing your custom content you would set the same category on those items.  

    This will also add the same filter to the search page in the Anything dropdown.

    Here is the code used by the Ideas Application to implement the ISearchCategories interface.

    using Telligent.Evolution.Extensibility.Api.Entities.Version1;
    using Telligent.Evolution.Extensibility.Content.Version1;
    using Telligent.Evolution.Extensibility.Version1;
    namespace Telligent.Evolution.Ideation.Plugins
        public class IdeaSearchCategories : IPlugin, ISearchCategories, ITranslatablePlugin
            ITranslatablePluginController _translations;
            public const string IdeaSearchCategory = "ideas";
            #region IPlugin Members
            public string Name
                get { return "Ideas Search Categories"; }
            public string Description
                get { return "Adds search-related categories to support ideas being indexed."; }
            public void Initialize()
            #region ISearchCategories Members
            public SearchCategory[] GetCategories()
                return new SearchCategory[] { 
    				new SearchCategory (IdeaSearchCategory, _translations.GetLanguageResourceValue("Ideas_Search_Category_Name"))
            #region ITranslatablePlugin Members
            public Translation[] DefaultTranslations
                    var translation = new Translation("en-US");
                    translation.Set("Ideas_Search_Category_Name", "Ideas");
                    return new Translation[] { translation };
            public void SetController(ITranslatablePluginController controller)
                _translations = controller;

  • Thank you, that is what I need!


    Maybe do you have complete source codes for Ideation plugin? Can you share them?

Reply Children
No Data