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; $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]); $link = $this->urlGenerator->linkToRoute( 'files.View.showFile', ['fileid' => $result->fileId] ); $searchResultEntry = new SearchResultEntry( $avatarUrl, $result->name, $path, $link, '', true ); $searchResultEntry->addAttribute('fileId', (string)$result->fileId); $searchResultEntry->addAttribute('path', $path); return $searchResultEntry; }, $this->legacyProvider->search($query->getTerm())) ); } }