0

I need to customize the search results page in Liferay in the following way:

  • results must be displayed as a list of card with title, abstract (if present) and link to detail
  • on the side of the page, there should be list of tags or categories of the results

How can I achieve that? Should I customize existing JSP or create a new OSGi bundle?

Milen Dyankov
  • 2,972
  • 14
  • 25
stecava
  • 71
  • 10
  • That would depend a lot on what exactly you want to customize. – Milen Dyankov Aug 23 '19 at 10:19
  • search results must be displayed as a list of card with title, abstract (if present) and link to detail. Also add, on the side of the page, list of tags or categories of the results – stecava Aug 23 '19 at 10:21
  • yep, I am afraid this is a tall request for a SO post. If you need pointers, you would probably need to create a new bundle, a fragment actually to customize the JSPs. The list of tags and categories is normally easy, you just add the corresponding portlets to the search page (if you are using the default page, it is supposed to be there...). If your search is to behave more like a filter for tags and categories, it is easier to use the asset publisher than the search itself.. – Victor Aug 23 '19 at 13:00
  • ok thank you victor :) how can i create a new bundle or a fragments? which is the best way? – stecava Aug 23 '19 at 13:20
  • I would use a fragment, https://portal.liferay.dev/docs/7-2/customization/-/knowledge_base/c/jsp-overrides-using-osgi-fragments if you need examples, you can use the blade tool to get it – Victor Aug 23 '19 at 19:45

1 Answers1

1

add, on the side of the page, list of tags or categories of the results

You can do that by configuring your own search page from the provided facets.

results must be displayed as a list of card with title, abstract (if present) and link to detail

For this you have some options:

  • change the look and feel of the Search Result portlet with CSS from the theme or portlet's Look and Feel configuration (all the data you need is already in the generated DOM)
  • customize the JSP(s) in the Search Result portlet
  • build our own search result portlet with the same logic but different display and use it instead.
Milen Dyankov
  • 2,972
  • 14
  • 25
  • thank you for the answer Milen, i think i will customize the jsp. How can i create a osgi module with the custom jsp? the documentation is very poor – stecava Aug 26 '19 at 12:37
  • Well it's not rocket science. It's straightforward in fact. If you prefer sample over docs have a look [here](https://github.com/liferay/liferay-blade-samples/tree/7.2/gradle/overrides/module-jsp-override) – Milen Dyankov Aug 26 '19 at 13:42
  • thank you very much for the support! i made it using blade! – stecava Aug 27 '19 at 08:29