item_id column is too short

Created on 22 November 2016, over 7 years ago
Updated 15 November 2023, 8 months ago

Problem/Motivation

We have a case where the indexed entity ID is a string that may go up to 255 characters. This fails with:

Drupal\Core\Database\DatabaseExceptionWrapper: SQLSTATE[22001]: String data, right truncated: 1406 Data too long for column    [error]
'item_id' at row 1: INSERT INTO {search_api_item} (index_id, datasource, item_id, changed, status) VALUES
(:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3,
:db_insert_placeholder_4); Array
(
    [:db_insert_placeholder_0] => articles
    [:db_insert_placeholder_1] => entity:entity_abc
    [:db_insert_placeholder_2] =>
entity:entity_abc/https://www.kwz-bzss.fgmd.eu/fr/bcss/page/content/websites/xanax1/services/docutheque/webservices_value_123456/Specific-documentation-SW.html#ReplaceIdentificati-22:und
    [:db_insert_placeholder_3] => 1479823527
    [:db_insert_placeholder_4] => 1
)
 in Drupal\search_api\Plugin\search_api\tracker\Basic->trackItemsInserted() (line 177 of
web/modules/contrib/search_api/src/Plugin/search_api/tracker/Basic.php).

Proposed resolution

Increase the size of DB column to an acceptable maximum limit of 2048 characters. Drop the primary key index. This was used only to assure the unicity but that is already assured in \Drupal\search_api\Plugin\search_api\tracker\Basic::trackItemsInserted()

Remaining tasks

User interface changes

API changes

Data model changes

πŸ› Bug report
Status

Closed: won't fix

Version

1.0

Component

Framework

Created by

πŸ‡·πŸ‡΄Romania claudiu.cristea Arad πŸ‡·πŸ‡΄

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.

Production build 0.69.0 2024