Closed dev3k closed 10 months ago
similar to #7537
I did some debugging and found this https://github.com/filamentphp/filament/commit/c89f86bad00dc42dca8fa467b21d48e2c66687ea PR https://github.com/filamentphp/filament/pull/8784
search_collation always return null on mysql
$databaseConnection->getConfig('search_collation')
to make it work it should've been 'collation' instead of 'search_collation'
$databaseConnection->getConfig('collation')
I dont know why it's 'search_collation' maybe postgres ? I never used it before 😄
Hello, Same issue here.
But to address the issue (until it is resolved by the package), I performed the search query independently, as follows:
public static function table(Table $table): Table
{
$activeLocale = $table->getLivewire()->activeLocale ?? 'en'; // 👈 Here
return $table
->columns([
TextColumn::make('title')
// 👇 Here
->searchable(query: fn (Builder $query, string $search) => $query->whereRaw("JSON_EXTRACT(LOWER(title), '$.$activeLocale') LIKE LOWER('%$search%')")) // 👈 Here
])
}
+1
please look @ my pull request https://github.com/filamentphp/filament/pull/9732
this fixed the issue for me
Package
filament/filament
Package Version
v3.0.95
Laravel Version
v10.31.0
Livewire Version
v3.1.0
PHP Version
PHP 8.2.9
Problem description
When you search a translatable column I get the following error
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'json_extract(title, "$.en")' in 'where clause'
Expected behavior
it should be like
Steps to reproduce
just visit http://json-column.test/admin/posts?tableSearch=AA
Reproduction repository
https://github.com/dev3k/json-column
Relevant log output
No response