Browse Source
Fix search ordering
Signed-off-by: Robin Appelman <robin@icewind.nl>
pull/3850/head
Robin Appelman
9 years ago
committed by
Morris Jobke
No known key found for this signature in database
GPG Key ID: 9CE5ED29E7FCD38A
3 changed files with
14 additions and
1 deletions
-
3rdparty
-
lib/private/Files/Cache/Cache.php
-
lib/private/Files/Cache/QuerySearchHelper.php
|
|
|
@ -1 +1 @@ |
|
|
|
Subproject commit 48420b6fd7012d23550e2c43541b4b4ad0a85aa5 |
|
|
|
Subproject commit a82f327d1ded4b8a24e99dea721f82e1f69153f5 |
|
|
|
@ -666,6 +666,8 @@ class Cache implements ICache { |
|
|
|
|
|
|
|
$query->andWhere($this->querySearchHelper->searchOperatorToDBExpr($builder, $searchQuery->getSearchOperation())); |
|
|
|
|
|
|
|
$this->querySearchHelper->addSearchOrdersToQuery($query, $searchQuery->getOrder()); |
|
|
|
|
|
|
|
if ($searchQuery->getLimit()) { |
|
|
|
$query->setMaxResults($searchQuery->getLimit()); |
|
|
|
} |
|
|
|
|
|
|
|
@ -26,6 +26,7 @@ use OCP\Files\IMimeTypeLoader; |
|
|
|
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 |
|
|
|
@ -185,4 +186,14 @@ class QuerySearchHelper { |
|
|
|
} |
|
|
|
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()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |