Search code examples
liferayliferay-6

Search a specific search of a journal article based on the user type


I have this requirement:

  • We have a journalarticle and we wish to have sections which have content for internal and external users for the application.
  • We are able to hide the content from rendering by implementing custom template on web content display and using a simple custom-field for a user which helps us to classify it.

Having said that when we search something as an external user, the search portlet is able to fetch an article where the search text is a part of internal user content, and due to the above mentioned template the content is not visible.

In short, from the user's perspective the resultant article does not match the searched term.

I wish to seek some pointer to check whether there is a mechanism to ensure that when an external user searches something then we only search the dynamic-element of the doc which matches the user type?

We have thousands of such articles and create multiple copy of the same article does not seems viable solution.. so any pointers would be a great help.

Liferay version : 6.2 GA4 CE

Thanks! AJ


Solution

  • First of all: Not finding a search term in a document can be a sign of good working synonym resolution in the search engine. It's questionable if this behaviour is always wrong or only in this particular case. Remember google bombs?

    That being said, I believe that this architecture of half-visible documents is flawed from the beginning. Ideally I'd suggest to change it, for example by splitting the information to two articles, so that you can use the standard permissions to resolve. If you link both, you can determine how/which article or template to use. It's not an ideal solution, but might be a workaround.

    Another workaround might be to change Liferay's indexer component and index two different versions of the article, with two different permissions. Of course, you'll have to change the search side as well, so that you'll find each article at most once, even if it's now twice in the search engine.

    Again - not ideal, but might be the quickest fix that you can get right now without changing the underlying architecture. However, to change the underlying architecture is my actual recommendation.