Content access processor hides custom entities

Created on 13 January 2020, over 5 years ago
Updated 20 June 2025, 14 days ago

I'm having a problem with the Content access search processor on elasticsearch 6. I'm actually not sure if this is a problem with search API or elasticsearch connector, but I'll start here first.
As soon as I activate the processor, all custom entities disappear from anonymous searches. We use quite a lot of custom entities in our search, so it's a major problem. I tried to debug this issue, and here's what I found:

- processor creates a condition group, and treats some content types as 'affected' and some as 'unaffected'. It creates a big OR condition, that should pass all of the unaffected content types and check some more data for the affected ones. Here's the stringified condition (for an anonymous user).

  [
    search_api_datasource = 'entity:adapter_servicenow_kb'
  OR
    search_api_datasource = 'entity:file'
  OR
    search_api_datasource = 'entity:group'
  OR
    search_api_datasource = 'entity:user'
  OR
    [
      status = true
    AND
      [
        node_grants = 'node_access_all:0'
      OR
        node_grants = 'node_access_gnode_anonymous:1986'
      OR
        node_grants = 'node_access__all'
      ]
    ]
  ]

- All the checks (four of them at the top) that should be unaffected by the processor and pass right away actually don't and are not shown in search results
- It doesn't happen only for anonymous users, anyone without the 'bypass node access' permission is affected
- I tried changing the condition structure and my conclussion is that once the node_grants field is added to the condition the bug occurs

I will be grateful if you could help me find the source of this issue or point me in the right direction. I also tried debugging the elasticsearch queries that are produced out of this but they weren't as straightforward as the stringified condition above and I had no experience working with raw elasticsearch.

πŸ› Bug report
Status

Needs review

Version

7.0

Component

Code

Created by

πŸ‡΅πŸ‡±Poland bjarzyna

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡ΈπŸ‡ͺSweden twod Sweden

    The patch in #8 does not work, nothing pulls the fields out of "extra data" for the indexing query. #6 still works though, and I have not yet noticed any issues with Views.

    I couldn't use the 'entity type' field in this case because ContentAccess puts conditions on 'search_api_datasource', which didn't get indexed without the #6 patch.

Production build 0.71.5 2024