Copied to clipboard

Flag this post as spam?

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

  • Søren Kottal 618 posts 3965 karma points MVP 4x c-trib
    Aug 30, 2019 @ 15:08
    Søren Kottal

    Reindex single node in v8

    Anyone know how to reindex a single node in ExternalIndex in v8?

  • Matt Brailsford 3699 posts 19472 karma points MVP 9x c-trib
    Aug 30, 2019 @ 15:14
    Matt Brailsford

    I used to do the following in v7

    public static class LuceneHelper
        public static void ReindexNode(int id, string indexName, string indexType)
            var xmlStr = umbraco.library.GetXmlNodeById(id.ToString()).Current.OuterXml;
            var xml = XElement.Parse(xmlStr);
                .ReIndexNode(xml, indexType);

    I'm not sure how you get the XML for a node now in v8, but hopefully it gives you a starting point.

  • Remko 105 posts 259 karma points
    Aug 30, 2019 @ 15:19


    I simply use this:

    ExamineManager.Instance.Indexes.FirstOrDefault(i => i.Name == "ExternalIndex")?.IndexItem(new ValueSet(id));

    where id is string

  • Søren Kottal 618 posts 3965 karma points MVP 4x c-trib
    Aug 30, 2019 @ 15:46
    Søren Kottal

    Ooh, didn't know you could just new ValueSet(id)

    I got it working by doing index.IndexItems(_valueSetBuilder.GetValueSets(arrayOfIContents));

    index is the IIndex, _valueSetBuilder is IPublishedContentValueSetBuilder, and e is coming from the Published event on the content service

  • Steve Megson 151 posts 998 karma points MVP c-trib
    Aug 30, 2019 @ 15:59
    Steve Megson

    I think you have to do it your way. Unless I'm missing something, new ValueSet(id) will just create an object with that ID and no other fields populated, so indexing that won't do the right thing.

Please Sign in or register to post replies

Write your reply to: