This is in relation to:
https://github.com/R-Knowsys/elasticray/issues/14"
Results for search are taking too long to show up.
This issue has been explored and we realised that Liferay is matching each document to the permissions of the logged in user. Elasticsearch itself is returning the results fast and elasticray is giving them to Liferay but Liferay permission checking code is slowing up the process.
Solution will be a 2 pronged approach:
1. We will try and index permissions in elasticsearch and retrieve only those results matching the perissions.
2. Additionally we will see if we can write a hook for Liferay to check permissions from elasticsearch index. This might turn out to be another plugin itself."
This could be one approach to solve the problem:
1.
Index the assets along with user permissions. Send userid as parameter
to Elasticsearch and filter results based on user permissions. This
should be fairly simple and will return only relevant results. This will
reduce work needed to be done by Liferay permissioning code.
2.
See if we can write a hook for Liferay permissioning to use the
permission index from above. Even if we cannot do this step, we will
definitely gain some performance benefit as a result of 1.
3. If we cannot do "2" above, can we fork the Liferay search portlet itself and release our own version of it? This may be slightly messy.
4.
In any case, we will have to see how to efficiently manage indexing
within ES itself. If I am not worng, ES automatically updates
stale/invalidated indexes? Can we send a signal to invalidate partial
index? i.e. invalidate/update only that part of the index affecting a
new user, new document or change in permissions? This will be a good
challenge and if we solve this, we will have a very comprehensive
solution to accommodate future Liferay releases.
We should also post this problem in Liferay forums along with our tentative solution.