Copied to clipboard

Flag this post as spam?

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

  • Alex Brown 129 posts 616 karma points
    Jun 19, 2018 @ 12:00
    Alex Brown

    Hi All

    I was wondering if anyone has successfully managed to search the External index for a UDI?

    I've got a part of my site where a user can make selections which triggers node ids to be sent to the server. I need to be able to search these ids in Examine. These ids are dictated by a Multinode Treepicker which stores the data as UDIs.

    Since I have the ids I want to search on, I could just convert them to UDIs, however whenever I search all or part of a UDI it returns no results.

    Anyone done something similar?

    I'm aware of NuPickers but I wanted to try avoid using any packages if possible.

  • Søren Kottal 432 posts 2625 karma points MVP c-trib
    Jul 30, 2018 @ 21:21
    Søren Kottal

    Hi Alex

    Problem is, that the UDI is not (by default) indexed in Examine. In stead, the guid (which the UDI is based upon) is. The guid is indexed in the column Key.

    So you could convert your UDI to a Guid, and find what you need.

    Ie. umb://document/4fed18d8c5e34d5e88cfff3a5b457bf2 would need to be transformed into 4fed18d8-c5e3-4d5e-88cf-ff3a5b457bf2.

  • Rachel Breeze 2 posts 74 karma points c-trib
    1 week ago
    Rachel Breeze


    So I hit the same issue and resolved it by adding an examine indexer that added a custom field for the UDI

     protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
                .GatheringNodeData += OnGatheringNodeData;
        private void OnGatheringNodeData(object sender, IndexingNodeDataEventArgs e)
            var node = new Node(e.NodeId);
            e.Fields.Add(CmsConstants.ExamineConstants.CATEGORY_FILTER, BuildFilter(node, "categories"));
        public string BuildFilter(Node node, string property)
                var values = node.Properties[property].ToString();
                var ids = new StringBuilder();
                foreach (var id in values.Split(','))
                    if (ids.Length > 0)
                        ids.Append(" ");
                    ids.Append(id.Replace("umb://document/", ""));
                return ids.ToString();

    Then when searching the index by the document, where I had the primary key of the document and not the UDI I used the umbraco helper to get the page by id, something like this (_umbracoHelper is of type UmbracoHelper):

    var page = _umbracoHelper.TypedContent(pageId);

    Then the value to use in examine search becomes:

Please Sign in or register to post replies

Write your reply to: