Skip to content
This repository was archived by the owner on Jan 9, 2024. It is now read-only.

Commit e8dadf9

Browse files
gmartinezmsonowal
authored andcommitted
Fix for fulltext w/where() not working
When using fulltext search + where() clause(s) in place even when I knew the combination should bring entries none was retrieved. I found that the $params array get populated in the wrong order. Eg; select *, MATCH(name,email,data) AGAINST(? IN NATURAL LANGUAGE MODE) AS relevance from `users` where guid = ? AND MATCH(name,email,data) AGAINST(? IN BOOLEAN MODE) array:2 [▼ "guid" => "9260a604-22b6-4075-891e-a82d52ba69fe" 0 => "text2search4" ] after ksort($params,SORT_NATURAL); the $params lists gets; array:2 [▼ 0 => "text2search4" "guid" => "9260a604-22b6-4075-891e-a82d52ba69fe" ]
1 parent 83e0662 commit e8dadf9

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/Engines/MySQLEngine.php

+1
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ public function search(Builder $builder)
6565

6666
$whereRawString = $mode->buildWhereRawString($builder);
6767
$params = $mode->buildParams($builder);
68+
ksort($params,SORT_NATURAL);
6869

6970
$model = $builder->model;
7071
$query = $model::whereRaw($whereRawString, $params);

0 commit comments

Comments
 (0)