| @@ 154-162 (lines=9) @@ | ||
| 151 | * @link https://www.elastic.co/guide/en/elasticsearch/reference/5.0/query-dsl-range-query.html |
|
| 152 | * @return self $this; |
|
| 153 | */ |
|
| 154 | public function whereBetween($field, $min, $max, $dateFormat = null) |
|
| 155 | { |
|
| 156 | $params = ['gte' => $min, 'lte' => $max]; |
|
| 157 | if ($dateFormat) { |
|
| 158 | $params['format'] = $dateFormat; |
|
| 159 | } |
|
| 160 | $this->addFilter('range', [$field => $params]); |
|
| 161 | return $this; |
|
| 162 | } |
|
| 163 | ||
| 164 | ||
| 165 | /** |
|
| @@ 191-199 (lines=9) @@ | ||
| 188 | * @example $query->whereGreaterOrEqual("created", "31/12/2016" , "dd/MM/yyyy") |
|
| 189 | * @example $query->whereGreaterOrEqual("seller.rating", 4) |
|
| 190 | */ |
|
| 191 | public function whereGreaterOrEqual($field, $value, $dateFormat = null) |
|
| 192 | { |
|
| 193 | $params = ['gte' => $value]; |
|
| 194 | if ($dateFormat) { |
|
| 195 | $params['format'] = $dateFormat; |
|
| 196 | } |
|
| 197 | $this->addFilter('range', [$field => $params]); |
|
| 198 | return $this; |
|
| 199 | } |
|
| 200 | ||
| 201 | /** |
|
| 202 | * Добавить фильтр "больше чем" |
|
| @@ 211-219 (lines=9) @@ | ||
| 208 | * @example $query->whereGreater("created", "31/12/2016" , "dd/MM/yyyy") |
|
| 209 | * @example $query->whereGreater("seller.rating", 4) |
|
| 210 | */ |
|
| 211 | public function whereGreater($field, $value, $dateFormat = null) |
|
| 212 | { |
|
| 213 | $params = ['gt' => $value]; |
|
| 214 | if ($dateFormat) { |
|
| 215 | $params['format'] = $dateFormat; |
|
| 216 | } |
|
| 217 | $this->addFilter('range', [$field => $params]); |
|
| 218 | return $this; |
|
| 219 | } |
|
| 220 | ||
| 221 | /** |
|
| 222 | * Добавить фильтр "меньше или равно" |
|
| @@ 231-239 (lines=9) @@ | ||
| 228 | * @example $query->whereLessOrEqual("created", "31/12/2016" , "dd/MM/yyyy") |
|
| 229 | * @example $query->whereLessOrEqual("seller.rating", 4) |
|
| 230 | */ |
|
| 231 | public function whereLessOrEqual($field, $value, $dateFormat = null) |
|
| 232 | { |
|
| 233 | $params = ['lte' => $value]; |
|
| 234 | if ($dateFormat) { |
|
| 235 | $params['format'] = $dateFormat; |
|
| 236 | } |
|
| 237 | $this->addFilter('range', [$field => $params]); |
|
| 238 | return $this; |
|
| 239 | } |
|
| 240 | ||
| 241 | ||
| 242 | /** |
|
| @@ 252-260 (lines=9) @@ | ||
| 249 | * @example $query->whereLess("created", "31/12/2016" , "dd/MM/yyyy") |
|
| 250 | * @example $query->whereLess("seller.rating", 4) |
|
| 251 | */ |
|
| 252 | public function whereLess($field, $value, $dateFormat = null) |
|
| 253 | { |
|
| 254 | $params = ['lt' => $value]; |
|
| 255 | if ($dateFormat) { |
|
| 256 | $params['format'] = $dateFormat; |
|
| 257 | } |
|
| 258 | $this->addFilter('range', [$field => $params]); |
|
| 259 | return $this; |
|
| 260 | } |
|
| 261 | ||
| 262 | ||
| 263 | /** |
|