yabhq / laravel-scout-mysql-driver

Laravel Scout MySQL Driver
MIT License
522 stars 113 forks source link

Issue with multiple where on same column #58

Open MoogyG opened 6 years ago

MoogyG commented 6 years ago
$searchText = 'test';
$query_builder = User::search($searchText);
$query_builder->where('a <=', 10);
$query_builder->where('b >=', 100);

it's correct, result :

select count(*) as aggregate from `beats` where a< '10' AND b> '100' 
AND MATCH(title) AGAINST('test' IN NATURAL LANGUAGE MODE)

but if i do

$searchText = 'test';
$query_builder = User::search($searchText);
$query_builder->where('a <=', 10);
$query_builder->where('a >=', 100);

result


"Illuminate\Database\QueryException

SQLSTATE[HY093]: Invalid parameter number (SQL: select count(*) as aggregate 
from `users` where a<= 100 AND a>= test AND MATCH(title) AGAINST(? IN NATURAL LANGUAGE MODE))
msonowal commented 6 years ago

@MoogyG Try this as

$searchText = 'test';
$query_builder = User::search($searchText);
$query_builder->where('a', '<=', 10);
$query_builder->where('a', '>=', 100);
MoogyG commented 6 years ago

Not working, result :

select count(*) as aggregate from `users` where a = '>=' AND MATCH(title) AGAINST('test' IN NATURAL LANGUAGE MODE)
varuog commented 6 years ago

I am facing same issue. need some workaround for this

Kaishiyoku commented 3 years ago

Same issue here