File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -83,6 +83,15 @@ public function get(): Collection
8383 * Build and get the search query
8484 */
8585 public function getQuery (): EloquentBuilder
86+ {
87+ return $ this ->getQueryWithoutOrderBy ()
88+ ->orderBy ('score ' , 'desc ' );
89+ }
90+
91+ /**
92+ * Build and get the search query
93+ */
94+ public function getQueryWithoutOrderBy (): EloquentBuilder
8695 {
8796 if (is_null ($ this ->query )) {
8897 $ this ->setQuery ($ this ->model ->query ());
@@ -92,8 +101,7 @@ public function getQuery(): EloquentBuilder
92101
93102 return $ this ->query
94103 ->withExpression ('id_and_total_score ' , $ this ->getScoreQuery ())
95- ->join ('id_and_total_score ' , $ table .'.id ' , 'id_and_total_score.id ' )
96- ->orderBy ('score ' , 'desc ' );
104+ ->join ('id_and_total_score ' , $ table .'.id ' , 'id_and_total_score.id ' );
97105 }
98106
99107 /**
You can’t perform that action at this time.
0 commit comments