Add attributes to file search results

Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
This commit is contained in:
Christoph Wurst 2020-12-02 14:26:48 +01:00
parent cc92d5a293
commit 885dabb761
No known key found for this signature in database
GPG Key ID: CC42AC2A7F0E56D8
1 changed files with 4 additions and 1 deletions

View File

@ -110,13 +110,16 @@ class FilesSearchProvider implements IProvider {
? $this->urlGenerator->linkToRouteAbsolute('core.Preview.getPreviewByFileId', ['x' => 32, 'y' => 32, 'fileId' => $result->id])
: '';
return new SearchResultEntry(
$searchResultEntry = new SearchResultEntry(
$thumbnailUrl,
$result->name,
$this->formatSubline($result),
$this->urlGenerator->getAbsoluteURL($result->link),
$result->type === 'folder' ? 'icon-folder' : $this->mimeTypeDetector->mimeTypeIcon($result->mime_type)
);
$searchResultEntry->addAttribute('fileId', (string)$result->id);
$searchResultEntry->addAttribute('path', $result->path);
return $searchResultEntry;
}, $this->fileSearch->search($query->getTerm()))
);
}