Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Scott Lightening 3 posts 53 karma points
    Aug 26, 2014 @ 15:11
    Scott Lightening
    0

    Using examine to index a multi node picker to remove the comas.

    I'm using Umbraco 7 to index a multi node picker so I can replace the coma separation with spaces.

    This is the code I am using but all the default index return null.

    using System;
    using System.Text;
    using System.Xml.Linq;
    using Examine;
    using umbraco.BusinessLogic;
    using UmbracoExamine;
    
    namespace Site.App_Code
    {
        public class ExamineEvents : ApplicationBase
        {
    
            public ExamineEvents()
            {
                var y = ExamineManager.Instance;
                var x = ExamineManager.Instance.IndexProviderCollection["UmbracoExamine.UmbracoContentIndexer"];
                var b = ExamineManager.Instance.IndexProviderCollection["ExamineLuceneIndexSets"];
                var c = ExamineManager.Instance.IndexProviderCollection["InternalIndexSet"];
    
                ExamineManager.Instance.IndexProviderCollection["ExternalIndexSet"].GatheringNodeData += ExamineEvents_GatheringNodeData;
    
            }
    
    
            void ExamineEvents_GatheringNodeData(object sender, IndexingNodeDataEventArgs e)
            {
                GatheringNodeDataHandler(e);
            }
    
            private void GatheringNodeDataHandler(IndexingNodeDataEventArgs e)
            {
                //grab the current data from the Fields collection
                var mntp = e.Fields["sector"];
                //let's get rid of those commas!
                mntp = mntp.Replace(",", " ");
                //now put it back into the Fields so we can pretend nothing happened!
                e.Fields["sector"] = mntp;
            }
        }
    }

     

  • Scott Lightening 3 posts 53 karma points
    Aug 26, 2014 @ 16:57
    Scott Lightening
    100

    Fixed. I just needed to use ExternalIndexer. 

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies