Skip to content

Commit

Permalink
Fixing search for MySQL (joomla#13571)
Browse files Browse the repository at this point in the history
* Use $query->castAsChar instead of casting to integer

* Codestyle
  • Loading branch information
Thomas Hunziker authored and andrepereiradasilva committed Jan 12, 2017
1 parent 0ea7024 commit bf57f06
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions plugins/search/content/content.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)')
Expand Down Expand Up @@ -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)')
Expand Down

0 comments on commit bf57f06

Please sign in to comment.