Drupal's entity status is string, not boolean - causes Solr error "Too many clauses in boolean query"

Created on 20 March 2023, over 1 year ago
Updated 16 June 2023, about 1 year ago

search_api_solr and Drupal core seem to disagree about whether an entity's status is stored as a boolean or a string - or maybe search_api_solr could allow a little more fuzziness in evaluating booleans?

Setup

  • Solr version: 8.11
  • Drupal Core version: 9.5.5
  • Search API version: 1.28.0
  • Search API Solr version: 4.2.10
  • Configured Solr Connector: Standard

Steps to reproduce

Don't use the Entity status processor on your search index.

Add the "Published" field to your search index (machine name status). It will default to field type "Boolean".

Add a filter to your search View on the Published field. It will look like a boolean field, and let you filter by "Published is equal to True" (or False).

Use the command line interface to run drush cron to reindex your content. On a large volume of content (~17,000 nodes) we started getting a "Too many clauses in boolean query" (and increasing maxBooleanClauses didn't help).

Upon inspection, the view configuration was saving the status filter value as '1' or '0' (strings) - not 1 or 0 (integers) and not true or false (boolean).

Changing the field type for the status field in the search index to "Integer" didn't work, but changing it to "String" (and recreating the filter on the view to accommodate) did let the content finish reindexing with a working filter on the view.

We realized after figuring that out that it was a bad idea for us to index unpublished content anyway (we'll handle showing staff unpublished content using a simple Drupal-based View instead of bloating our Solr indexes), but I thought I should report this finding in case it's tripping anyone else up.

πŸ› Bug report
Status

Active

Version

1.0

Component

General code

Created by

πŸ‡ΊπŸ‡ΈUnited States Kasey_MK

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

Comments & Activities

Production build 0.69.0 2024