Forums de discussion

Creating facet based on layout uuid

Valentin BECK, modifié il y a 7 années.

Creating facet based on layout uuid

New Member Publications: 8 Date d'inscription: 08/08/14 Publications récentes
Hi all,

I need to create a facet based on the layout of the document.

For exemple, if I create a web content on the page "Test", I need to retrieve a facet with the layout "Test" and when i click on this facet, I get my web content.

When we add a web content on a page, a keyword is added like that (JournalArticleIndexer.java) :

document.addKeyword(Field.LAYOUT_UUID, article.getLayoutUuid());

But, in the index, this layout is never used and it's not appear on the index of Solr (or Lucene).

Is it possible to do that? And how?

Thank you in advance.

Best regards,
Valentin
thumbnail
Amos Fong, modifié il y a 7 années.

RE: Creating facet based on layout uuid

Liferay Legend Publications: 2047 Date d'inscription: 07/10/08 Publications récentes
Hi Valentin,

I think this field is not what you think it is. There used to be a type of Layout called web content (https://issues.liferay.com/browse/LPS-19760), I believe that's what that field was used for.

I don't think the layouts the web content is added on is currently added to the index. You could do it with some customization though.

1. Create a PostIndexProcessor (https://dev.liferay.com/develop/tutorials/-/knowledge_base/6-2/extending-the-indexer-post-processor-using-a-hook)
2. Add the info you want yourself. Take a look at JournalOpenSearchImpl to see an example of how to find out which Layouts a web content is on.

HTH