Answer the question
In order to leave comments, you need to log in
Why does the column name become lowercase when querying (nicolaslopezj/searchable)?
I use laravel and the nicolaslopezj/searchable package, after reading the documentation I decided to get down to business, set up the model:
protected $searchable = [
'columns' => [
'products.clientArticle' => 10,
],
];
$products = Product::search($query)->get();
SQLSTATE[42703]: Undefined column: 7 ERROR: column products.clientarticle
select * from (select "products".*, max((case when LOWER(products.clientArticle) ILIKE ? then 150 else 0
end) + (case when LOWER(products.clientArticle) ILIKE ? then 50 else 0 end) + (case when LOWER(products.clientArticle)
ILIKE ? then 10 else 0 end)) as relevance from "products" where "products"."deletedAt" is null group by "products"."id"
having (case when LOWER(products.clientArticle) ILIKE ? then 150 else 0 end) + (case when LOWER(products.clientArticle)
ILIKE ? then 50 else 0 end) + (case when LOWER(products.clientArticle) ILIKE ? then 10 else 0 end) >= 10.00 order by
"relevance" desc) as products
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question