$query->andWhere($this->querySearchHelper->searchOperatorToDBExpr($builder, $searchQuery->getSearchOperation()));
+ $this->querySearchHelper->addSearchOrdersToQuery($query, $searchQuery->getOrder());
+
if ($searchQuery->getLimit()) {
$query->setMaxResults($searchQuery->getLimit());
}
use OCP\Files\Search\ISearchBinaryOperator;
use OCP\Files\Search\ISearchComparison;
use OCP\Files\Search\ISearchOperator;
+use OCP\Files\Search\ISearchOrder;
/**
* Tools for transforming search queries into database queries
}
return $builder->createNamedParameter($value, $type);
}
+
+ /**
+ * @param IQueryBuilder $query
+ * @param ISearchOrder[] $orders
+ */
+ public function addSearchOrdersToQuery(IQueryBuilder $query, array $orders) {
+ foreach ($orders as $order) {
+ $query->addOrderBy($order->getField(), $order->getDirection());
+ }
+ }
}