Problem/Motivation

One node type 'away' with a field with access control that is also an og group node. The same group at the moment gets referenced by all the 'away' nodes. There are ~800 nodes, and when passed to Search API Solr to check the access Solr fails with way too many booleans of the same value.

Example Solr Exception:

 OR (sm_search_api_access_node:"node_access_content_access_rid:8")
 OR (sm_search_api_access_node:"node_access_content_access_rid:14") 
OR (sm_search_api_access_node:"node_access_nodeaccess_nodereference_view:70") 
OR (sm_search_api_access_node:"node_access_nodeaccess_nodereference_view:70") 
OR (sm_search_api_access_node:"node_access_nodeaccess_nodereference_view:70") 
OR (sm_search_api_access_node:"node_access_nodeaccess_nodereference_view:70") 
OR (sm_search_api_access_node:"node_access_nodeaccess_nodereference_view:70") 
OR (sm_search_api_access_node:"node_access_nodeaccess_nodereference_view:70")
 OR ....

That 70 gets ~800 times in the OR.

Proposed resolution

array_unique() on the output and don't store the large arrays in the cache table to unserialize because it won't scale.

Comments

joelpittet created an issue. See original summary.

joelpittet’s picture

Status: Active » Needs review
StatusFileSize
new4.17 KB

Here's a patch to show you what I propose, may look a bit much but it's mostly removing the cache_set()/cache_get() and array_unique() on the output.

svenryen’s picture

I made a different patch, addressing the issue at the root rather than changing the cached data. Here's the code. It fixes a slowness on sites that occurs after adding lots of content to the site, after which views took half a minute to render. This patch reduces view rendering time to a few seconds or even below that.

vegardjo’s picture

Status: Needs review » Reviewed & tested by the community

Running patch from @svenryen in production, reducing page load dramatically, and no found regressions.

andypost’s picture