searching on hierarchical content

Agile IT asked on April 20, 2017 10:50

I have following output to be searched

Image Text

How should I prepare the page types and transformations so that even if user search the "media" then each tile which contains media should be shown in result.

Any help please.

Recent Answers


Chetan Sharma answered on April 20, 2017 12:19

Dilip two things:-

  1. Could you please post better resolution images?
  2. Frame your requirement in more details?

Thanks, Chetan

0 votesVote for this answer Mark as a Correct answer

Agile IT answered on April 20, 2017 12:27

single block of search result with two tile is as below,

Image Text

overall block is yearly container and two tiles within this are financial results which can contain many files to download(can be link). Now when user search by keyword "half" or "media" both tile should be shown as in image. So I would like to be able to create page types for this kind of output and search and display the result in the same format.

FYI https://devnet.kentico.com/questions/displaying-nested-items has the more detail about the html n content. but note that such design of page type is making trouble.

Let me know if I can provide any more detail. Thanks!

0 votesVote for this answer Mark as a Correct answer

Chetan Sharma answered on April 20, 2017 12:52 (last edited on December 10, 2019 02:30)

Just clarifying . You are not interested in searching in documents you would like to show just attachments? Right?. Assuming this as true I would create a Page type with two scenarios

  1. If the file attachments are well defined i.e you know that they will fall under one of the listed categories like Media Release, Presentation - PDF. If this is the case I would have these fields on my page types and upload them on the respective field using media library and in my search transformation I would recogonize this page type class and write a logic to show these fields too.

  2. If the categories are not well defined - In this case I would create a page type with one field and would use attachments to upload relevant documents to a page. I would use then this code in my transformation for these kind of results to get all attachments.

{% foreach (attachment in Documents[NodeALiasPath].AllAttachments) { "<a href='/getattachment/" + attachment.AttachmentGUID + "/attachment.aspx'>" + attachment.AttachmentName + "</a>"; } |(identity)GlobalAdministrator%}

2 votesVote for this answer Mark as a Correct answer

Agile IT answered on April 20, 2017 13:20

I need to search on attachment titles, each attachement is different page type with following fields

Image Text

And this download items are under financial result page type (which contain date in red and title e.g. "2016 Full year Result). So I need to be able to search from every title and also from year dropdown.

So when we search with text "media" then full tile should be shown in search result not only the particular document. Currently when I search media then the result only shows the one download item but I would like to return financial detail(which is parent document of all downloadable items).

0 votesVote for this answer Mark as a Correct answer

Chetan Sharma answered on April 20, 2017 13:36

Well in that case this is how it can be done. Though I am curious to know why you've different page types for attachments since they are same in terms of field. Couldn't you have an extra field for type?

Nonetheless.

  1. Nested repeater - A nested repeater that will search for current document that came up in the search result while iterating over it find it's parent and then get everything under it. You need to make sure that you are resulting a "SET" as there are chances to get duplicate records.

  2. Custom search - If i want this kind of search. I would have a custom search that will return me results in the form of JSON. This will give me better control over what I want to return for my data. And of course this will give you better performance.

Does this help?

1 votesVote for this answer Mark as a Correct answer

Agile IT answered on April 20, 2017 19:59

  1. I created different page type because downloadable item can be file or link and such item could be any number so instead creating fixed number of field i wanted make possible any number of such item.

Can you please provide example of both way. Mostly i like second way. Which document should i follow to create such custom search and how to return json data. Thanks

0 votesVote for this answer Mark as a Correct answer

Rui Wang answered on April 21, 2017 17:13

Which level are you searching? The lowest level only? Because the 2 upper levels are just "folders". If that's the case, then you may need to use custom API for search, once you get the result, group them together based on the parent node. Then go up 2 level to find the year, then section, to generate the custom output in code.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.