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