yabhq/laravel-scout-mysql-driver

UTF8 problem

hojabbr opened this issue · 1 comments

can't do a search in Persian or Arabic

SQLSTATE[HY000]: General error: 1271 Illegal mix of collations for operation 'like' (SQL: select count(*) as aggregate from items where (idLIKE %سلام% ORtitleLIKE %سلام% ORintroLIKE %سلام% ORdescriptionLIKE %سلام% ORthumbnailLIKE %سلام% ORimagesLIKE %سلام% ORpriceLIKE %سلام% ORstatusLIKE %سلام% ORuser_idLIKE %سلام% ORcreated_atLIKE %سلام% ORupdated_atLIKE %سلام% ORdeleted_atLIKE %سلام% ORslugLIKE %سلام%) anditems.deleted_at is null)

Found the problem, the date fields are causing the problem so excluded them with a function within the Model:

    public function toSearchableArray()
    {
        return $this->only('id', 'title', 'intro', 'description');
    }