diff --git a/lib/Service/SystemService.php b/lib/Service/SystemService.php index 8cb31e6e3..3c9aad5c6 100644 --- a/lib/Service/SystemService.php +++ b/lib/Service/SystemService.php @@ -80,6 +80,7 @@ public function getSiteUsersAndGroups(string $query = ''): array { * get a list of user objects from the backend matching the query string */ public function search(string $query = ''): array { + $startSearchTimer = microtime(true); $items = []; $types = [ IShare::TYPE_USER, @@ -91,8 +92,9 @@ public function search(string $query = ''): array { // Add circles to the search, if app is enabled $types[] = IShare::TYPE_CIRCLE; } - + $startCollaborationSearchTimer = microtime(true); [$result, $more] = $this->userSearch->search($query, $types, false, $maxResults, 0); + $this->logger->debug('Search took {time}s', ['time' => microtime(true) - $startCollaborationSearchTimer]); if ($more) { $this->logger->info('Only first {maxResults} matches will be returned.', ['maxResults' => $maxResults]); @@ -150,7 +152,7 @@ public function search(string $query = ''): array { $items[] = $this->userMapper->getUserObject(Circle::TYPE, $item['value']['shareWith'])->getRichUserArray(); } } - + $this->logger->debug('Search took {time}s overall', ['time' => microtime(true) - $startSearchTimer]); return $items; } diff --git a/tests/Unit/Db/OptionMapperTest.php b/tests/Unit/Db/OptionMapperTest.php index 0db2409ce..f5a9eaab7 100644 --- a/tests/Unit/Db/OptionMapperTest.php +++ b/tests/Unit/Db/OptionMapperTest.php @@ -6,7 +6,7 @@ * SPDX-License-Identifier: AGPL-3.0-or-later */ -namespace OCA\Polls\Db; +namespace OCA\Polls\Tests\Unit\Db; use OCA\Polls\Tests\Unit\UnitTestCase; @@ -24,11 +24,11 @@ class OptionMapperTest extends UnitTestCase { private OptionMapper $optionMapper; private PollMapper $pollMapper; private VoteMapper $voteMapper; - /** @var Poll[] $polls */ + /** @var Poll[] $polls */ private array $polls = []; - /** @var Option[] $options */ + /** @var Option[] $options */ private array $options = []; - /** @var Vote[] $votes */ + /** @var Vote[] $votes */ private array $votes = []; /** @@ -52,13 +52,13 @@ protected function setUp(): void { for ($count = 0; $count < 2; $count++) { - /** @var Option $option */ + /** @var Option $option */ $option = $this->fm->instance('OCA\Polls\Db\Option'); $option->setPollId($poll->getId()); $option->syncOption(); array_push($this->options, $this->optionMapper->insert($option)); - /** @var Vote $vote */ + /** @var Vote $vote */ $vote = $this->fm->instance('OCA\Polls\Db\Vote'); $vote->setPollId($option->getPollId()); $vote->setUserId('TestUser');