diff --git a/apps/dav/lib/CalDAV/CalDavBackend.php b/apps/dav/lib/CalDAV/CalDavBackend.php index 915976d7dd3e6..914bc38742b22 100644 --- a/apps/dav/lib/CalDAV/CalDavBackend.php +++ b/apps/dav/lib/CalDAV/CalDavBackend.php @@ -2144,6 +2144,12 @@ public function searchPrincipalUri(string $principalUri, if (isset($options['offset'])) { $calendarObjectIdQuery->setFirstResult($options['offset']); } + if (isset($options['start']) && $options['start'] instanceof DateTimeInterface) { + $calendarObjectIdQuery->andWhere($calendarObjectIdQuery->expr()->lte('co.lastoccurence', $calendarObjectIdQuery->createNamedParameter($options['start']->getTimestamp()))); + } + if (isset($options['end']) && $options['end'] instanceof DateTimeInterface) { + $calendarObjectIdQuery->andWhere($calendarObjectIdQuery->expr()->gte('co.firstoccurence', $calendarObjectIdQuery->createNamedParameter($options['end']->getTimestamp()))); + } $result = $calendarObjectIdQuery->executeQuery(); $matches = $result->fetchAll(); @@ -3172,7 +3178,7 @@ public function pruneOutdatedSyncTokens(int $keep = 10_000): int { $maxId = (int) $result->fetchOne(); $result->closeCursor(); if (!$maxId || $maxId < $keep) { - return 0; + return 0; } $query = $this->db->getQueryBuilder(); diff --git a/apps/dav/lib/Search/EventsSearchProvider.php b/apps/dav/lib/Search/EventsSearchProvider.php index 07fc90397ed2d..bfe764d7e9e53 100644 --- a/apps/dav/lib/Search/EventsSearchProvider.php +++ b/apps/dav/lib/Search/EventsSearchProvider.php @@ -42,7 +42,6 @@ * @package OCA\DAV\Search */ class EventsSearchProvider extends ACalendarSearchProvider { - /** * @var string[] */ @@ -107,13 +106,15 @@ public function search(IUser $user, $searchResults = $this->backend->searchPrincipalUri( $principalUri, - $query->getTerm(), + $query->getFilter('term', ''), [self::$componentType], self::$searchProperties, self::$searchParameters, [ 'limit' => $query->getLimit(), 'offset' => $query->getCursor(), + 'start' => $query->getFilter('start', null), + 'end' => $query->getFilter('end', null), ] ); $formattedResults = \array_map(function (array $eventRow) use ($calendarsById, $subscriptionsById):SearchResultEntry { diff --git a/apps/dav/lib/Search/TasksSearchProvider.php b/apps/dav/lib/Search/TasksSearchProvider.php index 763720ee4ae0a..12bfc0f62e21f 100644 --- a/apps/dav/lib/Search/TasksSearchProvider.php +++ b/apps/dav/lib/Search/TasksSearchProvider.php @@ -41,7 +41,6 @@ * @package OCA\DAV\Search */ class TasksSearchProvider extends ACalendarSearchProvider { - /** * @var string[] */ @@ -100,13 +99,15 @@ public function search(IUser $user, $searchResults = $this->backend->searchPrincipalUri( $principalUri, - $query->getTerm(), + $query->getFilter('term', ''), [self::$componentType], self::$searchProperties, self::$searchParameters, [ 'limit' => $query->getLimit(), 'offset' => $query->getCursor(), + 'start' => $query->getFilter('start'), + 'end' => $query->getFilter('end'), ] ); $formattedResults = \array_map(function (array $taskRow) use ($calendarsById, $subscriptionsById):SearchResultEntry {