Copied to clipboard

Flag this post as spam?

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


  • Owain Williams 480 posts 1412 karma points MVP 6x c-trib
    Mar 02, 2020 @ 11:28
    Owain Williams
    0

    Examine / Nested Content - display NC in Examine results.

    Hi, I've created pages using Nested Content and now I would like to be able to show a snippet of this content on a search results page.

    So if I searched 'Monday' and I had a page that came back with Monday, I could show either the sentence that Monday appears or just a generic first couple of lines of that page.

    Anyone got any pointer on where to start with this? I'm using Umbraco 8

    Just now when I search, I can see Nested Content is indexed but it's maybe JSON? That's a guess but one thing is for sure, it's not just the text from the page.

    [{"key":"edc70bce-67f7-48bb-9bcd-5d8fd36790b0","name":"Heading","ncContentTypeAlias":"heading","headingText":"Monday's News"},{"key":"b889d2a5-169a-4c4b-a616-b1f0483ba3fd","name":"Rich Text Editor","ncContentTypeAlias":"richTextEditor","richText":"<p>Day tree open let all upon his, divide void. Land creepeth beast Thing unto. You're saying rule from seasons moving unto Seed were meat life set land. Thing day open hath own doesn't evening bearing all also for upon void. Brought.</p>\n<p>Their you're. 
    

    Thanks! Owain.

  • Nik 1593 posts 7151 karma points MVP 6x c-trib
    Mar 02, 2020 @ 11:34
    Nik
    1

    Hi Owain,

    Okay so the first thing to note, nested content blocks don't create their own entries in Examine. They are all stored in the field on the page, e.g. "MyNestedContent" in a json array.

    To clean this up, you need to hook into one of the examine events (either the gathering node data, or document writing [their names are different in v8 and I can't recall them while writing sorry]). Then you can cleanse your data when the index is being written in one of two ways...

    1. you could strip out all the json
    2. you could actually look at the page and manually index those fields and sub types yourself giving you the ability to look up other related info (such as if you were using MNTP's you could look up the node name instead of the guid).

    This would then allow you to have clean data in your index.

    However, you still wouldn't get explicit results in your search results for a "nested content block". To do this you'd need to do alot more work, creating individual entries in the index for your blocks with references to the owner document etc.

    Nik

  • Owain Williams 480 posts 1412 karma points MVP 6x c-trib
    Mar 02, 2020 @ 11:49
    Owain Williams
    0

    hmm. cheers Nik. I'm wondering if I maybe create a Summary text area within the backoffice which isn't Nested Content and use that as an initial step.

  • Matt Brailsford 4124 posts 22215 karma points MVP 9x c-trib
    Mar 02, 2020 @ 12:37
    Matt Brailsford
    0

    This is a bit old, but might help. This is what I would do in v7 to flatten out all JSON based property editors in examine into their own examine fields.

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

  • Owain Williams 480 posts 1412 karma points MVP 6x c-trib
    Mar 02, 2020 @ 13:37
    Owain Williams
    0

    Odd as in what I'm trying to do or odd example? :)

  • Matt Brailsford 4124 posts 22215 karma points MVP 9x c-trib
    Mar 02, 2020 @ 15:01
    Matt Brailsford
    0

    Is said Old, not Odd. As in the code snippet I'm linking to may need updating. 😂

  • Owain Williams 480 posts 1412 karma points MVP 6x c-trib
    Mar 02, 2020 @ 15:02
    Owain Williams
    0

    Ooops! Sorry, totally misread that :)

Please Sign in or register to post replies

Write your reply to:

Draft