@@ -410,7 +410,7 @@ public function aggregate($function, $columns = []): mixed
410410
411411 if (isset ($ results [0 ])) {
412412 $ result = (array ) $ results [0 ];
413- $ esResult = new ElasticResult () ;
413+ $ esResult = new ElasticResult ;
414414 $ esResult ->setQueryMeta ($ results ->getQueryMeta ());
415415 $ esResult ->setValue ($ result ['aggregate ' ]);
416416
@@ -813,29 +813,41 @@ public function whereTimestamp($column, $operator = null, $value = null, $boolea
813813 /**
814814 * {@inheritDoc}
815815 */
816- public function orderByDesc ($ column, $ mode = null , $ missing = null ): static
816+ public function orderByDesc ($ column ): static
817817 {
818- return $ this ->orderBy ($ column , 'desc ' , $ mode , $ missing );
818+ return $ this ->orderBy ($ column , 'desc ' );
819819 }
820820
821821 /**
822822 * {@inheritdoc}
823823 */
824- public function orderBy ($ column , $ direction = 'asc ' , $ mode = null , $ missing = null ): static
824+ public function orderBy ($ column , $ direction = 'asc ' ): static
825825 {
826826 if (is_string ($ direction )) {
827827 $ direction = (strtolower ($ direction ) == 'asc ' ? 'asc ' : 'desc ' );
828828 }
829829
830830 $ this ->orders [$ column ] = [
831831 'order ' => $ direction ,
832- 'mode ' => $ mode ,
833- 'missing ' => $ missing ,
834832 ];
835833
836834 return $ this ;
837835 }
838836
837+ /**
838+ * Including outlier sort functions
839+ *
840+ * @return $this
841+ */
842+ public function withSort (string $ column , string $ key , mixed $ value ): static
843+ {
844+ $ currentColOrder = $ this ->orders [$ column ] ?? [];
845+ $ currentColOrder [$ key ] = $ value ;
846+ $ this ->orders [$ column ] = $ currentColOrder ;
847+
848+ return $ this ;
849+ }
850+
839851 /**
840852 * @param $unit @values: 'km', 'mi', 'm', 'ft'
841853 * @param $mode @values: 'min', 'max', 'avg', 'sum'
0 commit comments