diff options
author | John Molakvoæ <skjnldsv@users.noreply.github.com> | 2020-08-05 14:17:42 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-05 14:17:42 +0200 |
commit | a4d511d82767f54af086b366a6c08bc927cb870c (patch) | |
tree | df4b2e2fe552da5cf52e70ea04baef4e8658d421 /apps/dav/lib | |
parent | 05813561691aca15116334464a64e8be054ddcbf (diff) | |
parent | 71b62c4203a25beefeab73f73668919c813e3a50 (diff) | |
download | nextcloud-server-a4d511d82767f54af086b366a6c08bc927cb870c.tar.gz nextcloud-server-a4d511d82767f54af086b366a6c08bc927cb870c.zip |
Merge pull request #22099 from nextcloud/fix/unified-search
Diffstat (limited to 'apps/dav/lib')
-rw-r--r-- | apps/dav/lib/Search/ContactsSearchProvider.php | 12 | ||||
-rw-r--r-- | apps/dav/lib/Search/ContactsSearchResultEntry.php | 30 | ||||
-rw-r--r-- | apps/dav/lib/Search/EventsSearchProvider.php | 12 | ||||
-rw-r--r-- | apps/dav/lib/Search/EventsSearchResultEntry.php | 30 | ||||
-rw-r--r-- | apps/dav/lib/Search/TasksSearchProvider.php | 12 | ||||
-rw-r--r-- | apps/dav/lib/Search/TasksSearchResultEntry.php | 30 |
6 files changed, 30 insertions, 96 deletions
diff --git a/apps/dav/lib/Search/ContactsSearchProvider.php b/apps/dav/lib/Search/ContactsSearchProvider.php index 656b484c2b9..d87f87d7591 100644 --- a/apps/dav/lib/Search/ContactsSearchProvider.php +++ b/apps/dav/lib/Search/ContactsSearchProvider.php @@ -32,6 +32,7 @@ use OCP\IUser; use OCP\Search\IProvider; use OCP\Search\ISearchQuery; use OCP\Search\SearchResult; +use OCP\Search\SearchResultEntry; use Sabre\VObject\Component\VCard; use Sabre\VObject\Reader; @@ -95,6 +96,13 @@ class ContactsSearchProvider implements IProvider { /** * @inheritDoc */ + public function getOrder(): int { + return 7; + } + + /** + * @inheritDoc + */ public function search(IUser $user, ISearchQuery $query): SearchResult { if (!$this->appManager->isEnabledForUser('contacts', $user)) { return SearchResult::complete($this->getName(), []); @@ -116,7 +124,7 @@ class ContactsSearchProvider implements IProvider { 'offset' => $query->getCursor(), ] ); - $formattedResults = \array_map(function (array $contactRow) use ($addressBooksById):ContactsSearchResultEntry { + $formattedResults = \array_map(function (array $contactRow) use ($addressBooksById):SearchResultEntry { $addressBook = $addressBooksById[$contactRow['addressbookid']]; /** @var VCard $vCard */ @@ -130,7 +138,7 @@ class ContactsSearchProvider implements IProvider { $subline = $this->generateSubline($vCard); $resourceUrl = $this->getDeepLinkToContactsApp($addressBook['uri'], (string) $vCard->UID); - return new ContactsSearchResultEntry($thumbnailUrl, $title, $subline, $resourceUrl, 'icon-contacts-dark', true); + return new SearchResultEntry($thumbnailUrl, $title, $subline, $resourceUrl, 'icon-contacts-dark', true); }, $searchResults); return SearchResult::paginated( diff --git a/apps/dav/lib/Search/ContactsSearchResultEntry.php b/apps/dav/lib/Search/ContactsSearchResultEntry.php deleted file mode 100644 index 698fc1b3f4a..00000000000 --- a/apps/dav/lib/Search/ContactsSearchResultEntry.php +++ /dev/null @@ -1,30 +0,0 @@ -<?php - -declare(strict_types=1); - -/** - * @copyright Copyright (c) 2020, Georg Ehrke - * - * @author Georg Ehrke <oc.list@georgehrke.com> - * - * @license AGPL-3.0 - * - * This code is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License, version 3, - * as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License, version 3, - * along with this program. If not, see <http://www.gnu.org/licenses/> - * - */ -namespace OCA\DAV\Search; - -use OCP\Search\ASearchResultEntry; - -class ContactsSearchResultEntry extends ASearchResultEntry { -} diff --git a/apps/dav/lib/Search/EventsSearchProvider.php b/apps/dav/lib/Search/EventsSearchProvider.php index 43fc4f65dfc..6d264ae482e 100644 --- a/apps/dav/lib/Search/EventsSearchProvider.php +++ b/apps/dav/lib/Search/EventsSearchProvider.php @@ -28,6 +28,7 @@ use OCA\DAV\CalDAV\CalDavBackend; use OCP\IUser; use OCP\Search\ISearchQuery; use OCP\Search\SearchResult; +use OCP\Search\SearchResultEntry; use Sabre\VObject\Component; use Sabre\VObject\DateTimeParser; use Sabre\VObject\Property; @@ -81,6 +82,13 @@ class EventsSearchProvider extends ACalendarSearchProvider { /** * @inheritDoc */ + public function getOrder(): int { + return 10; + } + + /** + * @inheritDoc + */ public function search(IUser $user, ISearchQuery $query): SearchResult { if (!$this->appManager->isEnabledForUser('calendar', $user)) { @@ -102,7 +110,7 @@ class EventsSearchProvider extends ACalendarSearchProvider { 'offset' => $query->getCursor(), ] ); - $formattedResults = \array_map(function (array $eventRow) use ($calendarsById, $subscriptionsById):EventsSearchResultEntry { + $formattedResults = \array_map(function (array $eventRow) use ($calendarsById, $subscriptionsById):SearchResultEntry { $component = $this->getPrimaryComponent($eventRow['calendardata'], self::$componentType); $title = (string)($component->SUMMARY ?? $this->l10n->t('Untitled event')); $subline = $this->generateSubline($component); @@ -114,7 +122,7 @@ class EventsSearchProvider extends ACalendarSearchProvider { } $resourceUrl = $this->getDeepLinkToCalendarApp($calendar['principaluri'], $calendar['uri'], $eventRow['uri']); - return new EventsSearchResultEntry('', $title, $subline, $resourceUrl, 'icon-calendar-dark', false); + return new SearchResultEntry('', $title, $subline, $resourceUrl, 'icon-calendar-dark', false); }, $searchResults); return SearchResult::paginated( diff --git a/apps/dav/lib/Search/EventsSearchResultEntry.php b/apps/dav/lib/Search/EventsSearchResultEntry.php deleted file mode 100644 index f70f10a6e75..00000000000 --- a/apps/dav/lib/Search/EventsSearchResultEntry.php +++ /dev/null @@ -1,30 +0,0 @@ -<?php - -declare(strict_types=1); - -/** - * @copyright Copyright (c) 2020, Georg Ehrke - * - * @author Georg Ehrke <oc.list@georgehrke.com> - * - * @license AGPL-3.0 - * - * This code is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License, version 3, - * as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License, version 3, - * along with this program. If not, see <http://www.gnu.org/licenses/> - * - */ -namespace OCA\DAV\Search; - -use OCP\Search\ASearchResultEntry; - -class EventsSearchResultEntry extends ASearchResultEntry { -} diff --git a/apps/dav/lib/Search/TasksSearchProvider.php b/apps/dav/lib/Search/TasksSearchProvider.php index eee4694f08f..9a0a87eb5ab 100644 --- a/apps/dav/lib/Search/TasksSearchProvider.php +++ b/apps/dav/lib/Search/TasksSearchProvider.php @@ -28,6 +28,7 @@ use OCA\DAV\CalDAV\CalDavBackend; use OCP\IUser; use OCP\Search\ISearchQuery; use OCP\Search\SearchResult; +use OCP\Search\SearchResultEntry; use Sabre\VObject\Component; /** @@ -73,6 +74,13 @@ class TasksSearchProvider extends ACalendarSearchProvider { /** * @inheritDoc */ + public function getOrder(): int { + return 10; + } + + /** + * @inheritDoc + */ public function search(IUser $user, ISearchQuery $query): SearchResult { if (!$this->appManager->isEnabledForUser('tasks', $user)) { @@ -94,7 +102,7 @@ class TasksSearchProvider extends ACalendarSearchProvider { 'offset' => $query->getCursor(), ] ); - $formattedResults = \array_map(function (array $taskRow) use ($calendarsById, $subscriptionsById):TasksSearchResultEntry { + $formattedResults = \array_map(function (array $taskRow) use ($calendarsById, $subscriptionsById):SearchResultEntry { $component = $this->getPrimaryComponent($taskRow['calendardata'], self::$componentType); $title = (string)($component->SUMMARY ?? $this->l10n->t('Untitled task')); $subline = $this->generateSubline($component); @@ -106,7 +114,7 @@ class TasksSearchProvider extends ACalendarSearchProvider { } $resourceUrl = $this->getDeepLinkToTasksApp($calendar['uri'], $taskRow['uri']); - return new TasksSearchResultEntry('', $title, $subline, $resourceUrl, 'icon-checkmark', false); + return new SearchResultEntry('', $title, $subline, $resourceUrl, 'icon-checkmark', false); }, $searchResults); return SearchResult::paginated( diff --git a/apps/dav/lib/Search/TasksSearchResultEntry.php b/apps/dav/lib/Search/TasksSearchResultEntry.php deleted file mode 100644 index ec58ba80af9..00000000000 --- a/apps/dav/lib/Search/TasksSearchResultEntry.php +++ /dev/null @@ -1,30 +0,0 @@ -<?php - -declare(strict_types=1); - -/** - * @copyright Copyright (c) 2020, Georg Ehrke - * - * @author Georg Ehrke <oc.list@georgehrke.com> - * - * @license AGPL-3.0 - * - * This code is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License, version 3, - * as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License, version 3, - * along with this program. If not, see <http://www.gnu.org/licenses/> - * - */ -namespace OCA\DAV\Search; - -use OCP\Search\ASearchResultEntry; - -class TasksSearchResultEntry extends ASearchResultEntry { -} |