Zero 'Minimum chunk overlap' causes Typed property not initialized

Created on 20 August 2024, about 1 month ago
Updated 12 September 2024, 9 days ago

Problem/Motivation

When 'Minimum chunk overlap' is set to zero at Search API AI Search server configuration, an exception 'Typed property Drupal\ai_search\Base\EmbeddingStrategyPluginBase::$chunkMinOverlap must not be accessed before initialization' is thrown during indexing.

Steps to reproduce

Create new AI Search server and set 'Minimum chunk overlap' as 0.

Proposed resolution

The issue is ai_search/src/Base/EmbeddingStrategyPluginBase.php, lines 107-109, where the variable is not initialized if the value is 0.

My suggested solution would be replace the code with: $this->chunkMinOverlap = (int) $configuration['chunk_min_overlap'];

🐛 Bug report
Status

Fixed

Version

1.0

Component

AI Search

Created by

🇬🇧United Kingdom seogow

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024