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.
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...
you could strip out all the json
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.
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.
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.
Thanks! Owain.
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...
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
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.
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
Odd as in what I'm trying to do or odd example? :)
Is said Old, not Odd. As in the code snippet I'm linking to may need updating. 😂
Ooops! Sorry, totally misread that :)
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.