l10n->t('Comments'); } public function getOrder(string $route, array $routeParameters): int { if ($route === 'files.View.index') { // Files first return 0; } return 10; } public function search(IUser $user, ISearchQuery $query): SearchResult { return SearchResult::complete( $this->l10n->t('Comments'), array_map(function (Result $result) { $path = $result->path; $pathInfo = pathinfo($path); $isUser = $this->userManager->userExists($result->authorId); $avatarUrl = $isUser ? $this->urlGenerator->linkToRouteAbsolute('core.avatar.getAvatar', ['userId' => $result->authorId, 'size' => 42]) : $this->urlGenerator->linkToRouteAbsolute('core.GuestAvatar.getAvatar', ['guestName' => $result->authorId, 'size' => 42]); return new SearchResultEntry( $avatarUrl, $result->name, $path, $this->urlGenerator->linkToRouteAbsolute('files.view.index', [ 'dir' => $pathInfo['dirname'], 'scrollto' => $pathInfo['basename'], ]), '', true ); }, $this->legacyProvider->search($query->getTerm())) ); } }