Skip to content
This repository was archived by the owner on Dec 24, 2022. It is now read-only.

Commit bee0ed0

Browse files
author
Reza Shadman
committed
Remove coord, and add cache to the build section of the boolean filter:
1 parent 40c37f5 commit bee0ed0

File tree

2 files changed

+5
-45
lines changed

2 files changed

+5
-45
lines changed

src/Contracts/Filters/BooleanFilterInterface.php

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -106,20 +106,6 @@ public function iDontLike(FilterInterface $filter);
106106
*/
107107
public function iReallyNeed(FilterInterface $filter);
108108

109-
/**
110-
* See document on elasticsearch
111-
*
112-
* @return $this
113-
*/
114-
public function enableCoord();
115-
116-
/**
117-
* See document on elasticsearch
118-
*
119-
* @return $this
120-
*/
121-
public function disableCoord();
122-
123109
/**
124110
* Get musts array
125111
*

src/Filters/BooleanFilter.php

Lines changed: 5 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -68,15 +68,13 @@ public function toArray()
6868

6969
$this->checkFilter($filter);
7070

71-
$query = ['bool' => $filter];
71+
$filter = ['bool' => $filter];
7272

73-
$coord = $this->getAttribute('coord', false, null);
74-
75-
if ($coord !== null) {
76-
$query['bool']['disable_coord'] = !(bool) $coord;
73+
if ($status = $this->getCacheStatus()) {
74+
$filter['bool']['_cache'] = (bool) $status;
7775
}
7876

79-
return $query;
77+
return $filter;
8078
}
8179

8280
/**
@@ -267,30 +265,6 @@ public function iReallyNeed(FilterInterface $filter)
267265
return $this->must($filter);
268266
}
269267

270-
/**
271-
* See document on elasticsearch
272-
*
273-
* @return $this
274-
*/
275-
public function enableCoord()
276-
{
277-
$this->setAttribute('coord', true);
278-
279-
return $this;
280-
}
281-
282-
/**
283-
* See document on elasticsearch
284-
*
285-
* @return $this
286-
*/
287-
public function disableCoord()
288-
{
289-
$this->setAttribute('coord', false);
290-
291-
return $this;
292-
}
293-
294268
/**
295269
* Get musts array
296270
*
@@ -377,7 +351,7 @@ public function setCache($bool)
377351
*/
378352
public function getCacheStatus()
379353
{
380-
return (bool) $this->getAttribute('cache', false, null);
354+
return $this->getAttribute('cache', false, null);
381355
}
382356

383357
/**

0 commit comments

Comments
 (0)