diff --git a/CHANGELOG.md b/CHANGELOG.md index 09a91903d3..6765f1779e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ The format is mostly based on [Keep a Changelog](https://keepachangelog.com/en/1 ### Changed ### Fixed +- Fix search support for Nextcloud 28 # Releases ## [25.0.0-alpha2] - 2023-11-08 diff --git a/lib/Search/FeedSearchProvider.php b/lib/Search/FeedSearchProvider.php index 890692efcb..65b2059c5d 100644 --- a/lib/Search/FeedSearchProvider.php +++ b/lib/Search/FeedSearchProvider.php @@ -59,7 +59,12 @@ public function getOrder(string $route, array $routeParameters): int public function search(IUser $user, ISearchQuery $query): SearchResult { $list = []; - $term = strtolower($query->getTerm()); + if (method_exists($query, 'getFilter')) { + $term = $query->getFilter('term')?->get() ?? ''; + } else { + $term = $query->getTerm(); + } + $term = strtolower($term); foreach ($this->service->findAllForUser($user->getUID()) as $feed) { if (strpos(strtolower($feed->getTitle()), $term) === false) { diff --git a/lib/Search/FolderSearchProvider.php b/lib/Search/FolderSearchProvider.php index 315ac016ff..3997eba363 100644 --- a/lib/Search/FolderSearchProvider.php +++ b/lib/Search/FolderSearchProvider.php @@ -60,7 +60,12 @@ public function getOrder(string $route, array $routeParameters): int public function search(IUser $user, ISearchQuery $query): SearchResult { $list = []; - $term = strtolower($query->getTerm()); + if (method_exists($query, 'getFilter')) { + $term = $query->getFilter('term')?->get() ?? ''; + } else { + $term = $query->getTerm(); + } + $term = strtolower($term); foreach ($this->service->findAllForUser($user->getUID()) as $folder) { if (strpos(strtolower($folder->getName()), $term) === false) { diff --git a/lib/Search/ItemSearchProvider.php b/lib/Search/ItemSearchProvider.php index 1c0cb4a06b..acc0bcbadb 100644 --- a/lib/Search/ItemSearchProvider.php +++ b/lib/Search/ItemSearchProvider.php @@ -60,13 +60,13 @@ public function getOrder(string $route, array $routeParameters): int private function stripTruncate(string $string, int $length = 50): string { $string = strip_tags(trim($string)); - + if (strlen($string) > $length) { $string = wordwrap($string, $length); $string = explode("\n", $string, 2); $string = $string[0]; } - + return $string; } @@ -76,13 +76,19 @@ public function search(IUser $user, ISearchQuery $query): SearchResult $offset = (int) ($query->getCursor() ?? 0); $limit = $query->getLimit(); + if (method_exists($query, 'getFilter')) { + $term = $query->getFilter('term')?->get() ?? ''; + } else { + $term = $query->getTerm(); + } + $search_result = $this->service->findAllWithFilters( $user->getUID(), ListType::ALL_ITEMS, $limit, $offset, false, - [$query->getTerm()] + [$term] ); $last = end($search_result);