SiteFinity 6.3 unable to create Site Index based on node

Posted by Community Admin on 04-Aug-2018 18:32

SiteFinity 6.3 unable to create Site Index based on node

All Replies

Posted by Community Admin on 27-Feb-2014 00:00

Migrated a 3.7SP4 site to 6.3. Now trying to create site indexes and I had one in 3.7SP4 that was based on a Node. I do not see this in 6.3. Is it no longer available? Is there something that replaces it?

Thank you

Posted by Community Admin on 07-Mar-2014 00:00

Hi Cary,

Currently we do not provide an option to specify which pages the search index should be applied to. You can extend the current functionality and create a search index that applies only to a selection of pages by replacing the default PageInboundPipe with a custom one.

To do this, you need to create a class in you project that inherits from the default PageInboundPipe and to override the PushData method. In this method we will take only the pages under the group page titled "GroupPage" and then pass them to the base PushData() method, which will index only the pages under the selected group page: 

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Telerik.Sitefinity.Publishing.Pipes;
using Telerik.Sitefinity.Modules.Pages;
using Telerik.Sitefinity.Publishing;
using Telerik.Sitefinity;
using Telerik.Sitefinity.Publishing.Model;
using Telerik.Sitefinity.Pages.Model;
 
namespace SitefinityWebApp
    public class PageInboundPipeCustom : PageInboundPipe
    
        public override void PushData(IList<Telerik.Sitefinity.Publishing.PublishingSystemEventInfo> items)
        
            List<Telerik.Sitefinity.Publishing.PublishingSystemEventInfo> myItems = new List<Telerik.Sitefinity.Publishing.PublishingSystemEventInfo>();
 
            foreach (var item in items)
            
                PageNode node = null;
 
                if (item.Item is WrapperObject && ((WrapperObject)item.Item).WrappedObject != null)
                
                    node = (PageNode)((WrapperObject)item.Item).WrappedObject;
                
                else
                
                    node = ((PageNode)item.Item);
                
 
                if (node.Page != null && node.Page.Status == Telerik.Sitefinity.GenericContent.Model.ContentLifecycleStatus.Live)
                
                    while (true)
                    
                        node = node.Parent;
 
                        if (node.Title == "GroupPage")
                        
                            // this will index only one page node with its children,
                            // don`t add items here for the pages that shouldn`t be indexed
                            myItems.Add(item);
                            break;
                        
 
                        if (node.Parent == null)
                        
                            break;
                        
                    
                
            
 
            base.PushData(myItems);
        
    

Now, we should replace the default pipe with the custom one in the Global.asax file by unregistering the default pipe and registering the custom one:

protected void Application_Start(object sender, EventArgs e)
    Telerik.Sitefinity.Abstractions.Bootstrapper.Initialized += Bootstrapper_Initialized;
 
void Bootstrapper_Initialized(object sender, Telerik.Sitefinity.Data.ExecutedEventArgs e)
    if (e.CommandName == "Bootstrapped")
                    
        PublishingSystemFactory.UnregisterPipe(PageInboundPipe.PipeName);
    PublishingSystemFactory.RegisterPipe(PageInboundPipeCustom.PipeName, typeof(PageInboundPipeCustom));
    

After performing the above, the newly created search indexes will use the new custom pipe for pages.

Regards,
Sabrie Nedzhip
Telerik
Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items

This thread is closed