javaelasticsearchliferaybooleanquery

Liferay Search over structured webcontent matching attachment's term


We have a webcontent structure “S” with “Document and Media” field.

We have created a webcontent named « W » based on the previous structure « S » with a word file attachment named “a” with “hello” text inside of it.

We know that lucene/ElasticSearch is indexing the content of the attachment if it is a word or pdf file for example.

So we do a lucene search (using booleanQuery, fitering on journalArticle) to retrieves S webcontent to match “hello” search term.

But we saw that lucene, filtering on journalArticle, return a json like object with those data :

"ddm__keyword__87940__attachements_en_US":[ {\"groupId\":\"115863\",\"title\":\"a.word\",\"type\":\"document\",\"uuid\":\"dffd1d3d-8b78-a64c-4d0c-8d004d24cb75\"}]

It only have a reference to the DLFileEntry object.

Is there is a way, with only one request, to retrieve journal article matching word’s attachment?

We saw that Liferay propose “indexer Post Processor” that could help us to store DLFileEntry data inside of a new field of our webcontent but DLFileEntry indexing is asynchronous.

What can we do ?


Solution

  • We found a solution :

    1. we create a hook indexer post processor for JournalArticle class.
    2. in the indexer post processor, we retrieve the dlFileEntry and index it through document.addFile().
    3. in our portlet we can now request into file content with a booleanQuery (addterm) and with IndexSearcherHelperUtil.search

    only disadvantage is that file content is indexed twice (natively with dlFileEntry and now into journalArticle)