Message Boards

show a content's breadcrumb navigation in the search result

Gopal Prasad Satapathy, modified 3 Years ago.

show a content's breadcrumb navigation in the search result

Junior Member Posts: 51 Join Date: 3/29/18 Recent Posts

Hi,

Using DXP 7.1

How can i display a contents breadcrumb navigation in the search result for each item, when the search is performed from the default search bar.

 

Thanks

Gopal Prasad Satapathy, modified 3 Years ago.

RE: show a content's breadcrumb navigation in the search result

Junior Member Posts: 51 Join Date: 3/29/18 Recent Posts

Any pointer towards achieving this in 7.1?

thumbnail
Dominik Marks, modified 3 Years ago.

RE: show a content's breadcrumb navigation in the search result

Regular Member Posts: 149 Join Date: 8/29/12 Recent Posts

Could be difficult. What should be the breadcrumb for contents? Should it be the folder structure where the content is located? Should it be based on the page hierarchy where the content is placed? And which page if the content is placed on multiple pages?

Gopal Prasad Satapathy, modified 3 Years ago.

RE: RE: show a content's breadcrumb navigation in the search result

Junior Member Posts: 51 Join Date: 3/29/18 Recent Posts

Hello Dominik,

Thanks for your reply. Breadcrumb should be the page hierarchy where the content is placed and in case of multiple pages any of the page will be fine.

 

Any pointer on how to achieve this would be of great help.

 

Thanks.

Gopal Prasad Satapathy, modified 3 Years ago.

RE: RE: show a content's breadcrumb navigation in the search result

Junior Member Posts: 51 Join Date: 3/29/18 Recent Posts

Hello Dominik,

Please let me know if you have any thoughts on achieving this?

I have created a search-web-fragment from Fragment-Host: com.liferay.portal.search.web and in the JSP have aceess to com.liferay.portal.search.web.internal.result.display.context.SearchResultSummaryDisplayContext & com.liferay.portal.kernel.search.Document. But not sure how to proceed from there.

 

Thanks

thumbnail
Dominik Marks, modified 3 Years ago.

RE: show a content's breadcrumb navigation in the search result

Regular Member Posts: 149 Join Date: 8/29/12 Recent Posts

Hello,

I did it once using an application display template for the search results portlet. However as far as I know ADTs for search results are available in Liferay 7.3, only.

So in Liferay 7.1 you would have to do it in an JSP hook for the search results portlet.

If you are taking about Web Contents in the search results those may have an display page (layoutUuid). Based on that you can determine the Layout and based on that you can iterate through all parent Layouts to construct a breadcrumb. 

Henri Tanskanen, modified 1 Year ago.

RE: RE: show a content's breadcrumb navigation in the search result

New Member Post: 1 Join Date: 4/22/22 Recent Posts

Hi Dominik,

I need to do similar solution. Could you please give an example how to create documents path breadcrumb using ADTs in Liferay 7.3, thanks

Gopal Prasad Satapathy, modified 3 Years ago.

RE: show a content's breadcrumb navigation in the search result (Answer)

Junior Member Posts: 51 Join Date: 3/29/18 Recent Posts

Thanks.

Was able to do it

 

long groupId=Long.parseLong(document.getField("groupId").getValue()); 
                                    
                                    String uid=document.getField("uid").getValue();
                                    
                                    String articleId=document.getField("articleId_String_sortable").getValue();
                                    List<Long> layoutIds = JournalContentSearchLocalServiceUtil.getLayoutIds(groupId, true, articleId);
                                    long layoutId = 0;
                                    if (!layoutIds.isEmpty()) {
                                          layoutId = layoutIds.get(0).longValue();
                 
                                          Layout layout = LayoutLocalServiceUtil.getLayout(groupId, true, layoutId);
                                          List<Layout> listLayoutAs=layout.getAncestors();
                                          String langIddd=LanguageUtil.getLanguageId(request);                                                                                                                     breadcrmFrmLayout=GroupLocalServiceUtil.getGroup(groupId).getDescriptiveName();    
                                          Collections.reverse(listLayoutAs); 
                                         for(Layout lt:listLayoutAs){
                                            lt.getHTMLTitle(langIddd);
                                            breadcrmFrmLayout = breadcrmFrmLayout + "  " + lt.getHTMLTitle(langIddd);
                                                        }
                                          breadcrmFrmLayout=breadcrmFrmLayout+"  "+layout.getHTMLTitle(langIddd);                
                                          }