Views with Solr not working

Created on 1 December 2023, 12 months ago
Updated 25 January 2024, 10 months ago

Problem/Motivation

When we build a query for a view using Search Api with Solr, we get an Internal Server Error.

For error #0: Error: Call to a member function id() on bool in Drupal\graphql_core_schema\Plugin\GraphQL\DataProducer\ViewExecutor->resolve() (line 195 of /app/docroot/modules/contrib/graphql_core_schema/src/Plugin/GraphQL/DataProducer/ViewExecutor.php)
#0 [internal function]: Drupal\graphql_core_schema\Plugin\GraphQL\DataProducer\ViewExecutor->resolve()

Steps to reproduce

- Create an search api server using Solr
- Create an search api index
- Create a view using that search index
- Write a gql query in the graphql explorer

query {
  entityById(entityType: VIEW, id: "search_content") {
    ... on View {
      executable {
        execute {
          rows {
            id
            label
          }
        }
      }
    }
  }
}

Proposed resolution

Add a check on the base entity type before assigning the id at this line of code, 195
$this->entityTypeId = $executable->getBaseEntityType()->id();

🐛 Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

🇲🇺Mauritius whiz11

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

Comments & Activities

Production build 0.71.5 2024