Copied to clipboard

Flag this post as spam?

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


  • Paul de Quant 346 posts 1335 karma points
    Aug 15, 2019 @ 08:44
    Paul de Quant
    0

    Hello,

    Just porting some things across to V8. Can anyone tell me what the V8 equiv is of this code:

                    ExamineManager.Instance.IndexProviderCollection["ContentSearchIndexer"].GatheringNodeData
                     += (sender, e) => ExamineEvents.OnGatheringNodeData(sender, e);
    
                var indexer = (LuceneIndexer)ExamineManager.Instance.IndexProviderCollection["ContentSearchIndexer"];
                indexer.DocumentWriting += new EventHandler<Examine.LuceneEngine.DocumentWritingEventArgs>(ExamineEvents.Indexer_DocumentWriting);
    

    Thanks

  • Nik 1134 posts 4700 karma points MVP 2x c-trib
    Aug 15, 2019 @ 09:10
    Nik
    0

    Hey Paul

    public class IndexerComponent : IComponent
    {
        private readonly IExamineManager examineManager;
        public IndexerComponent(IExamineManager examineManager)
        {
               this.examineManager = examineManager;
        }
    
        public void Initialize()
        {
              var externalIndex = examineManager.Indexes.FirstOrDefault(i=>
                        i.Name.Equals("ExternalIndex");
             if(externalIndex != null)
             {
                   ((BaseIndexProvider)externalIndex).TransformingIndexValues += ExternalTransformingIndexValues;
             }
        }
    
        public void Terminate(){}
    
        private void ExternalTransformingIndexValues(object sender, IndexingItemEventArgs e)
        {
                // Do Stuff here
        }
    }
    

    Hope it helps,

    Nik

  • Paul de Quant 346 posts 1335 karma points
    Aug 15, 2019 @ 09:36
    Paul de Quant
    0

    Hi Nik,

    Thanks for this, I'll give it a go.

    In terms of whats changed for the OnGatheringNodeData, could you tell me how I access fields as before I could use e.Fields and loop through them, I cant seem to see this option anymore.

    Thanks

    Paul

  • Nik 1134 posts 4700 karma points MVP 2x c-trib
    Aug 15, 2019 @ 09:46
    Nik
    0

    Hi Paul,

    Have a look at e.ValueSet.

    This is used in multiple ways:

    //This should get the ID of the node being indexed
    e.ValueSet.Values["id"].FirstOrDefault()
    
    //Adding a value
    e.ValueSet.Add("FieldName", Value)
    
    //Returns a collection of values for a field, for example a list of strings for tags
    e.ValueSet.Values["fieldName"]
    

    Hope that helps

    Nik

  • Paul de Quant 346 posts 1335 karma points
    Aug 15, 2019 @ 09:51
    Paul de Quant
    0

    Thanks Nik, this is great - do you know how you remove a value - I used to use

    e.Fields.Remove("Property")
    

    I can see Add, but can't see Remove anywhere.

    Thanks

    Paul

  • Nik 1134 posts 4700 karma points MVP 2x c-trib
    Aug 15, 2019 @ 09:56
    Nik
    0

    I've not tried removing values, why are you trying to remove them?

  • Paul de Quant 346 posts 1335 karma points
    Aug 15, 2019 @ 10:15
    Paul de Quant
    0

    Can't remember exactly :) legacy code. I'll comment it out for now, see how it goes.

    I also have another function Indexer_DocumentWriting

                    var indexer = (LuceneIndexer)ExamineManager.Instance.IndexProviderCollection["ContentSearchIndexer"];
                indexer.DocumentWriting += new EventHandler<Examine.LuceneEngine.DocumentWritingEventArgs>(ExamineEvents.Indexer_DocumentWriting);
    

    Can you tell me what the equiv in v8 is for this? (Thanks for all your help by the way)

  • Nik 1134 posts 4700 karma points MVP 2x c-trib
    Aug 15, 2019 @ 10:19
    Nik
    0

    Not sure there is, think they've all been pushed into that event. Ismail might have a better knowledge on this so could be worth reaching out to him.

  • Paul de Quant 346 posts 1335 karma points
    Aug 15, 2019 @ 10:44
    Paul de Quant
    0

    Thanks - do you know how I can find him?

  • Nik 1134 posts 4700 karma points MVP 2x c-trib
    Aug 15, 2019 @ 11:02
    Nik
    0

    Twitter might be the best bet: https://twitter.com/ismailmayat or on Slack :-)

Please Sign in or register to post replies

Write your reply to:

Draft