Copied to clipboard

Flag this post as spam?

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


  • lele 102 posts 429 karma points
    Mar 16, 2016 @ 08:59
    lele
    0

    Add to Examine index

    Does the NestedContent already have a method or helper to add the values to the examine index correctly (without json stuff)?

    Thanks for your feedback.

  • Ismail Mayat 4511 posts 10062 karma points MVP 2x admin c-trib
    Mar 16, 2016 @ 09:28
    Ismail Mayat
    1

    Lele,

    As far as I am aware it does not you would have to using Examine gatheringnode data event and inject in yourself without json.

    Regards

    Ismail

  • Lee Kelleher 3993 posts 15620 karma points MVP 12x admin c-trib
    Mar 16, 2016 @ 10:16
    Lee Kelleher
    102

    Hi Lele,

    As Ismail says, there's nothing built-in and you would have to hook into Examine's GatheringNodeData event.

    For a code example, here is Matt Brailsford's snippet...

    https://gist.github.com/mattbrailsford/7eb24abe61a4c896b3e5

    Hope this helps.

    Cheers,
    - Lee

  • Lee Kelleher 3993 posts 15620 karma points MVP 12x admin c-trib
    Mar 16, 2016 @ 10:18
    Lee Kelleher
    2

    oops, just noticed that snippet has an extension method, DetectIsJson().

    You can find that here...

    https://gist.github.com/mattbrailsford/851d210b1c3edcd3b7f9

    Cheers,
    - Lee

  • Dave Woestenborghs 3429 posts 11693 karma points MVP 7x admin c-trib
    Mar 16, 2016 @ 10:21
    Dave Woestenborghs
    2

    Hi Lele, Ismael,

    I got this working in combination with the models builder.

    var content = string.Empty;
                var myNestedProperty = MyContentModel.GetModelPropertyType(x => x.NestedContentProperty);
                var key =
                    myNestedProperty
                        .PropertyTypeAlias;
    
                if (args.Fields.ContainsKey(key))
                {
                    var items = myNestedProperty.ConvertDataToSource(args.Fields[key], false) as List<IPublishedContent>;
    
                    if (items != null)
                    {
                        foreach (var item in items)
                        {                        
                            content += " " + item.GetProperty("title").DataValue;
                            content += " " + item.GetProperty("description").DataValue;
                        }
                    }
                }
    
                return content;
    

    Maybe this post can help you out as well : http://24days.in/umbraco/2014/working-with-complex-archetype-datatypes/

    It's about updating archetype with the ContentService. But there maybe some usefull code as well.

    Dave

  • lele 102 posts 429 karma points
    Mar 16, 2016 @ 11:00
    lele
    0

    Hi guys

    Awesome thanks! Nice examples!

    h5yr all

Please Sign in or register to post replies

Write your reply to:

Draft