2
2
3
3
namespace Basemkhirat \Elasticsearch ;
4
4
5
+ <<<<<<< HEAD
5
6
use Illuminate \Pagination \LengthAwarePaginator;
6
7
use Illuminate \Support \Collection ;
8
+ =======
9
+ use Illuminate \Support \Collection ;
10
+ use Illuminate \Pagination \LengthAwarePaginator ;
11
+ >>>>>>> 6 fdc2f25787d06ee7bcbcfcd82f36e727c753e44
7
12
use Illuminate \Support \Facades \Request ;
8
13
9
14
/**
@@ -101,6 +106,7 @@ class Query
101
106
protected $ sort = [];
102
107
103
108
/**
109
+ <<<<<<< HEAD
104
110
* Query scroll time
105
111
* @var string
106
112
*/
@@ -119,6 +125,8 @@ class Query
119
125
protected $ search_type ;
120
126
121
127
/**
128
+ =======
129
+ >>>>>>> 6fdc2f25787d06ee7bcbcfcd82f36e727c753e44
122
130
* Query limit
123
131
* @var int
124
132
*/
@@ -181,6 +189,7 @@ public function type($type)
181
189
*/
182
190
protected function getType ()
183
191
{
192
+ <<<<<<< HEAD
184
193
185
194
return $ this ->type ;
186
195
@@ -245,6 +254,9 @@ public function getScroll()
245
254
246
255
return $ this ->scroll ;
247
256
257
+ =======
258
+ return $ this ->type ;
259
+ >>>>>>> 6 fdc2f25787d06ee7bcbcfcd82f36e727c753e44
248
260
}
249
261
250
262
/**
@@ -261,6 +273,7 @@ public function take($take = 10)
261
273
}
262
274
263
275
/**
276
+ <<<<<<< HEAD
264
277
* Ignore bad HTTP response
265
278
* @param array|int $code
266
279
* @return $this
@@ -288,6 +301,9 @@ public function ignore($code)
288
301
289
302
/**
290
303
* Get the query limit
304
+ =======
305
+ * get the query limit
306
+ >>>>>>> 6fdc2f25787d06ee7bcbcfcd82f36e727c753e44
291
307
* @return int
292
308
*/
293
309
protected function getTake ()
@@ -426,7 +442,11 @@ public function _id($_id = false)
426
442
}
427
443
428
444
/**
445
+ <<<<<<< HEAD
429
446
* Set the query where clause
447
+ =======
448
+ * set the query where clause
449
+ >>>>>>> 6fdc2f25787d06ee7bcbcfcd82f36e727c753e44
430
450
* @param $name
431
451
* @param string $operator
432
452
* @param null $value
@@ -483,7 +503,11 @@ public function where($name, $operator = "=", $value = NULL)
483
503
}
484
504
485
505
/**
506
+ <<<<<<< HEAD
486
507
* Set the query inverse where clause
508
+ =======
509
+ * set the query inverse where clause
510
+ >>>>>>> 6fdc2f25787d06ee7bcbcfcd82f36e727c753e44
487
511
* @param $name
488
512
* @param string $operator
489
513
* @param null $value
@@ -535,7 +559,11 @@ public function whereNot($name, $operator = "=", $value = NULL)
535
559
}
536
560
537
561
/**
562
+ <<<<<<< HEAD
538
563
* Set the query where between clause
564
+ =======
565
+ * set the query where between clause
566
+ >>>>>>> 6fdc2f25787d06ee7bcbcfcd82f36e727c753e44
539
567
* @param $name
540
568
* @param $first_value
541
569
* @param $last_value
@@ -551,7 +579,11 @@ public function whereBetween($name, $first_value, $last_value)
551
579
}
552
580
553
581
/**
582
+ <<<<<<< HEAD
554
583
* Set the query where not between clause
584
+ =======
585
+ * set the query where not between clause
586
+ >>>>>>> 6fdc2f25787d06ee7bcbcfcd82f36e727c753e44
555
587
* @param $name
556
588
* @param $first_value
557
589
* @param $last_value
@@ -567,7 +599,11 @@ public function whereNotBetween($name, $first_value, $last_value)
567
599
}
568
600
569
601
/**
602
+ <<<<<<< HEAD
570
603
* Set the query where in clause
604
+ =======
605
+ * set the query where in clause
606
+ >>>>>>> 6fdc2f25787d06ee7bcbcfcd82f36e727c753e44
571
607
* @param $name
572
608
* @param array $value
573
609
* @return $this
@@ -587,7 +623,11 @@ public function whereIn($name, $value = [])
587
623
}
588
624
589
625
/**
626
+ <<<<<<< HEAD
590
627
* Set the query where not in clause
628
+ =======
629
+ * set the query where not in clause
630
+ >>>>>>> 6fdc2f25787d06ee7bcbcfcd82f36e727c753e44
591
631
* @param $name
592
632
* @param array $value
593
633
* @return $this
@@ -608,7 +648,11 @@ public function whereNotIn($name, $value = [])
608
648
609
649
610
650
/**
651
+ <<<<<<< HEAD
611
652
* Set the query where exists clause
653
+ =======
654
+ * set the query where exists clause
655
+ >>>>>>> 6fdc2f25787d06ee7bcbcfcd82f36e727c753e44
612
656
* @param $name
613
657
* @param bool $exists
614
658
* @return $this
@@ -673,6 +717,7 @@ public function query()
673
717
674
718
];
675
719
720
+ <<<<<<< HEAD
676
721
$ search_type = $ this ->getSearchType ();
677
722
678
723
if ($ search_type ){
@@ -686,6 +731,8 @@ public function query()
686
731
}
687
732
688
733
734
+ =======
735
+ >>>>>>> 6 fdc2f25787d06ee7bcbcfcd82f36e727c753e44
689
736
return $ query ;
690
737
691
738
}
@@ -707,6 +754,7 @@ protected function validate($query)
707
754
}
708
755
709
756
757
+ <<<<<<< HEAD
710
758
711
759
/**
712
760
* Clear scroll query id
@@ -750,6 +798,20 @@ public function get($scroll_id = NULL)
750
798
751
799
$ result = $ this ->connection ->search ($ query );
752
800
}
801
+ =======
802
+ /**
803
+ * Get the collection of results
804
+ * @return array|Collection
805
+ */
806
+ public function get ()
807
+ {
808
+
809
+ $ query = $ this ->query ();
810
+
811
+ $ this ->validate ($ query );
812
+
813
+ $ result = $ this ->connection ->search ($ query );
814
+ >>>>>>> 6 fdc2f25787d06ee7bcbcfcd82f36e727c753e44
753
815
754
816
return $ this ->getAll ($ result );
755
817
@@ -810,8 +872,12 @@ protected function getAll($result = [])
810
872
$ new ->max_score = $ result ["hits " ]["max_score " ];
811
873
$ new ->took = $ result ["took " ];
812
874
$ new ->timed_out = $ result ["timed_out " ];
875
+ <<<<<<< HEAD
813
876
$ new ->scroll_id = isset ($ result ["_scroll_id " ]) ? $ result ["_scroll_id " ] : NULL ;
814
877
$ new ->shards = (object )$ result ["_shards " ];
878
+ =======
879
+ $ new ->_shards = (object )$ result ["_shards " ];
880
+ >>>>>>> 6 fdc2f25787d06ee7bcbcfcd82f36e727c753e44
815
881
816
882
return $ new ;
817
883
}
@@ -1038,8 +1104,12 @@ public function raw()
1038
1104
* @param bool $callback
1039
1105
* @return mixed
1040
1106
*/
1107
+ <<<<<<< HEAD
1041
1108
function createIndex ($ name , $ callback = false )
1042
1109
{
1110
+ =======
1111
+ function createIndex ($ name , $ callback = false ){
1112
+ >>>>>>> 6 fdc2f25787d06ee7bcbcfcd82f36e727c753e44
1043
1113
1044
1114
$ index = new Index ($ name , $ callback );
1045
1115
@@ -1055,8 +1125,12 @@ function createIndex($name, $callback = false)
1055
1125
* @param $name
1056
1126
* @return mixed
1057
1127
*/
1128
+ <<<<<<< HEAD
1058
1129
function dropIndex ($ name )
1059
1130
{
1131
+ =======
1132
+ function dropIndex ($ name ){
1133
+ >>>>>>> 6 fdc2f25787d06ee7bcbcfcd82f36e727c753e44
1060
1134
1061
1135
$ index = new Index ($ name );
1062
1136
@@ -1072,8 +1146,12 @@ function dropIndex($name)
1072
1146
* @param bool $callback
1073
1147
* @return mixed
1074
1148
*/
1149
+ <<<<<<< HEAD
1075
1150
function create ($ callback = false )
1076
1151
{
1152
+ =======
1153
+ function create ($ callback = false ){
1154
+ >>>>>>> 6 fdc2f25787d06ee7bcbcfcd82f36e727c753e44
1077
1155
1078
1156
$ index = new Index ($ this ->index , $ callback );
1079
1157
@@ -1087,8 +1165,12 @@ function create($callback = false)
1087
1165
* Drop index [alias to dropIndex method]
1088
1166
* @return mixed
1089
1167
*/
1168
+ <<<<<<< HEAD
1090
1169
function drop ()
1091
1170
{
1171
+ =======
1172
+ function drop (){
1173
+ >>>>>>> 6 fdc2f25787d06ee7bcbcfcd82f36e727c753e44
1092
1174
1093
1175
$ index = new Index ($ this ->index );
1094
1176
0 commit comments