Skip to content

Commit 9402833

Browse files
committed
[FEATURE] Support greaterThan and lessThan for range filters
A range filter cannot be easily used in Eel expressions since the TypoScript parser does not allow double nested curly braces for now. The two new query builder methods expose a high-level interface for doing that.
1 parent 0db6a90 commit 9402833

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

Classes/Flowpack/ElasticSearch/ContentRepositoryAdaptor/Eel/ElasticSearchQueryBuilder.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,28 @@ public function exactMatch($propertyName, $propertyValue) {
241241
return $this->queryFilter('term', array($propertyName => $propertyValue));
242242
}
243243

244+
/**
245+
* add a range filter (gt) for the given property
246+
*
247+
* @param string $propertyName
248+
* @param mixed $propertyValue
249+
* @return ElasticSearchQueryBuilder
250+
*/
251+
public function greaterThan($propertyName, $propertyValue) {
252+
return $this->queryFilter('range', array($propertyName => array('gt' => $propertyValue)));
253+
}
254+
255+
/**
256+
* add a range filter (lt) for the given property
257+
*
258+
* @param string $propertyName
259+
* @param mixed $propertyValue
260+
* @return ElasticSearchQueryBuilder
261+
*/
262+
public function lessThan($propertyName, $propertyValue) {
263+
return $this->queryFilter('range', array($propertyName => array('lt' => $propertyValue)));
264+
}
265+
244266
/**
245267
* LOW-LEVEL API
246268
*/

0 commit comments

Comments
 (0)