From aa059af809e9bf3c6ddb6660f56f79967b8ce50b Mon Sep 17 00:00:00 2001 From: Thomas Hunziker Date: Thu, 12 Jan 2017 19:07:39 +0100 Subject: [PATCH] Fixing search for MySQL (#13571) * Use $query->castAsChar instead of casting to integer * Codestyle --- plugins/search/content/content.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/search/content/content.php b/plugins/search/content/content.php index 8151787b82fae..98ad4369216ad 100644 --- a/plugins/search/content/content.php +++ b/plugins/search/content/content.php @@ -183,7 +183,7 @@ public function onContentSearch($text, $phrase = '', $ordering = '', $areas = nu ->order($order); // Join over Fields. - $query->join('LEFT', '#__fields_values AS fv ON CAST(fv.item_id AS INTEGER) = a.id') + $query->join('LEFT', '#__fields_values AS fv ON fv.item_id = ' . $query->castAsChar('a.id')) ->join('LEFT', '#__fields AS f ON f.id = fv.field_id') ->where('(fv.context IS NULL OR fv.context = ' . $db->q('com_content.article') . ')') ->where('(f.state IS NULL OR f.state = 1)') @@ -262,7 +262,7 @@ public function onContentSearch($text, $phrase = '', $ordering = '', $areas = nu ->order($order); // Join over Fields. - $query->join('LEFT', '#__fields_values AS fv ON CAST(fv.item_id AS INTEGER) = a.id') + $query->join('LEFT', '#__fields_values AS fv ON fv.item_id = ' . $query->castAsChar('a.id')) ->join('LEFT', '#__fields AS f ON f.id = fv.field_id') ->where('(fv.context IS NULL OR fv.context = ' . $db->q('com_content.article') . ')') ->where('(f.state IS NULL OR f.state = 1)')