error: SQLSTATE[22003]: Numeric value out of range: 1264 Out of range value for column 'score' at row 8: INSERT INTO "search_api_db_social_all_text"

Created on 17 May 2023, over 1 year ago
Updated 25 January 2024, 10 months ago

Problem/Motivation

As soon as i tried to index my search API i get the following error:
error: SQLSTATE[22003]: Numeric value out of range: 1264 Out of range value for column 'score' at row 8: INSERT INTO "search_api_db_social_all_text"

Steps to reproduce

I am not sure how to reproduce this in another project. The problem was based on the rule that "Taken from core search to reflect less importance of words later in the text." Because the item has a long title it gets a super low score (high integer) that ends up returning a negative value and there for cannot be inserted to the table. The score column is "Unsigned" and therefore can't be a negative value.

Proposed resolution

My propose solution is to add max() around the current min() function. This wil make sure that if the value of the min() function a negative value is. Then the end result wil be a score of 0.
The score would then be determined by => $score = max(min((int) $score, 4294967295), 0);

๐Ÿ› Bug report
Status

Fixed

Version

1.0

Component

Database backend

Created by

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

Comments & Activities

Production build 0.71.5 2024