Open pakomp opened 1 year ago
I made it work somehow:
vendor/tailflow/laravel-orion/src/Drivers/Standard/QueryBuilder.php
@applySearchingToQuery
L429
if (!$caseSensitive) {
if (str_contains($qualifiedFieldName, '->')) {
$grammar = $whereQuery->getGrammar();
$qualifiedFieldName = $grammar->wrap($qualifiedFieldName);
$whereQuery->orWhereRaw(
"lower({$qualifiedFieldName}) like lower(?)",
['%'.$requestedSearchString.'%']
);
} else {
$whereQuery->orWhereRaw(
"lower({$qualifiedFieldName}) like lower(?)",
['%'.$requestedSearchString.'%']
);
}
} else {
$whereQuery->orWhere(
$qualifiedFieldName,
'like',
'%'.$requestedSearchString.'%'
);
}
Hi,
An Exception will be thrown if setting search.case_sensitive = false, and having a JSON field as searchable. The field is JSON type due to it being translatable (using the package spatie/laravel-translatable).
Exception:
SQLSTATE[42883]: Undefined function: 7 ERROR: function lower(json) does not exist
I'm using Postgresql
EDIT: The problem exists on other field types as well, Orion tries to do lower() on integer columns as well