@@ -98,8 +98,6 @@ public function processFind($wheres, $options, $columns): Results
9898 public function processSearch ($ searchParams , $ searchOptions , $ wheres , $ opts , $ fields , $ cols )
9999 {
100100 $ params = $ this ->buildSearchParams ($ this ->index , $ searchParams , $ searchOptions , $ wheres , $ opts , $ fields , $ cols );
101-
102- // dd($params);
103101
104102 return $ this ->_returnSearch ($ params , __FUNCTION__ );
105103
@@ -116,7 +114,8 @@ protected function _returnSearch($params, $source)
116114 return $ this ->_sanitizeSearchResponse ($ process , $ params , $ this ->_queryTag ($ source ));
117115 } catch (Exception $ e ) {
118116
119- return $ this ->_returnError ($ e ->getMessage (), $ e ->getCode (), $ params , $ this ->_queryTag ($ source ));
117+ $ error = $ this ->_returnError ($ e ->getMessage (), $ e ->getCode (), $ params , $ this ->_queryTag (__FUNCTION__ ));
118+ throw new Exception ($ error ->errorMessage );
120119 }
121120 }
122121
@@ -127,10 +126,9 @@ public function processDistinct($column, $wheres): Results
127126 if (is_array ($ column )) {
128127 $ col = $ column [0 ];
129128 }
130-
131-
129+ $ params = $ this ->buildParams ($ this ->index , $ wheres );
132130 try {
133- $ params = $ this -> buildParams ( $ this -> index , $ wheres );
131+
134132 $ params ['body ' ]['aggs ' ]['distinct_ ' .$ col ]['terms ' ] = [
135133 'field ' => $ col ,
136134 'size ' => $ this ->maxSize ,
@@ -146,7 +144,8 @@ public function processDistinct($column, $wheres): Results
146144 return $ this ->_return ($ data , $ process , $ params , $ this ->_queryTag (__FUNCTION__ ));
147145 } catch (Exception $ e ) {
148146
149- return $ this ->_returnError ($ e ->getMessage (), $ e ->getCode (), $ params , $ this ->_queryTag (__FUNCTION__ ));
147+ $ error = $ this ->_returnError ($ e ->getMessage (), $ e ->getCode (), $ params , $ this ->_queryTag (__FUNCTION__ ));
148+ throw new Exception ($ error ->errorMessage );
150149 }
151150
152151
@@ -195,7 +194,9 @@ public function processSave($data, $refresh): Results
195194
196195 return $ this ->_return ($ savedData , $ response , $ params , $ this ->_queryTag (__FUNCTION__ ));
197196 } catch (Exception $ e ) {
198- return $ this ->_returnError ($ e ->getMessage (), $ e ->getCode (), $ params , $ this ->_queryTag (__FUNCTION__ ));
197+ $ error = $ this ->_returnError ($ e ->getMessage (), $ e ->getCode (), $ params , $ this ->_queryTag (__FUNCTION__ ));
198+ throw new Exception ($ error ->errorMessage );
199+
199200 }
200201
201202
@@ -312,7 +313,8 @@ public function processDeleteAll($wheres, $options = []): Results
312313
313314 return $ this ->_return ($ response ['deleteCount ' ], $ response , $ params , $ this ->_queryTag (__FUNCTION__ ));
314315 } catch (Exception $ e ) {
315- return $ this ->_returnError ($ e ->getMessage (), $ e ->getCode (), $ params , $ this ->_queryTag (__FUNCTION__ ));
316+ $ error = $ this ->_returnError ($ e ->getMessage (), $ e ->getCode (), [], $ this ->_queryTag (__FUNCTION__ ));
317+ throw new Exception ($ error ->errorMessage );
316318 }
317319
318320 }
0 commit comments