mirror of
https://github.com/nextcloud/server.git
synced 2026-02-18 18:28:50 -05:00
Merge pull request #58327 from nextcloud/feat/1698/recent-files-include-recently-uploaded
feat: add upload_time support to file search and recent files
This commit is contained in:
commit
b0e99d0293
3 changed files with 11 additions and 2 deletions
|
|
@ -86,6 +86,7 @@ class FileSearchBackend implements ISearchBackend {
|
|||
new SearchPropertyDefinition('{DAV:}displayname', true, true, true),
|
||||
new SearchPropertyDefinition('{DAV:}getcontenttype', true, true, true),
|
||||
new SearchPropertyDefinition('{DAV:}getlastmodified', true, true, true, SearchPropertyDefinition::DATATYPE_DATETIME),
|
||||
new SearchPropertyDefinition('{http://nextcloud.org/ns}upload_time', true, true, true, SearchPropertyDefinition::DATATYPE_DATETIME),
|
||||
new SearchPropertyDefinition(FilesPlugin::SIZE_PROPERTYNAME, true, true, true, SearchPropertyDefinition::DATATYPE_NONNEGATIVE_INTEGER),
|
||||
new SearchPropertyDefinition(TagsPlugin::FAVORITE_PROPERTYNAME, true, true, true, SearchPropertyDefinition::DATATYPE_BOOLEAN),
|
||||
new SearchPropertyDefinition(FilesPlugin::INTERNAL_FILEID_PROPERTYNAME, true, true, false, SearchPropertyDefinition::DATATYPE_NONNEGATIVE_INTEGER),
|
||||
|
|
@ -298,6 +299,8 @@ class FileSearchBackend implements ISearchBackend {
|
|||
return $node->getName();
|
||||
case '{DAV:}getlastmodified':
|
||||
return $node->getLastModified();
|
||||
case '{http://nextcloud.org/ns}upload_time':
|
||||
return $node->getNode()->getUploadTime();
|
||||
case FilesPlugin::SIZE_PROPERTYNAME:
|
||||
return $node->getSize();
|
||||
case FilesPlugin::INTERNAL_FILEID_PROPERTYNAME:
|
||||
|
|
@ -458,6 +461,8 @@ class FileSearchBackend implements ISearchBackend {
|
|||
return 'mimetype';
|
||||
case '{DAV:}getlastmodified':
|
||||
return 'mtime';
|
||||
case '{http://nextcloud.org/ns}upload_time':
|
||||
return 'upload_time';
|
||||
case FilesPlugin::SIZE_PROPERTYNAME:
|
||||
return 'size';
|
||||
case TagsPlugin::FAVORITE_PROPERTYNAME:
|
||||
|
|
|
|||
|
|
@ -151,10 +151,12 @@ class QuerySearchHelper {
|
|||
|
||||
$builder = $this->getQueryBuilder();
|
||||
|
||||
$query = $builder->selectFileCache('file', false);
|
||||
|
||||
$requestedFields = $this->searchBuilder->extractRequestedFields($searchQuery->getSearchOperation());
|
||||
|
||||
$joinExtendedCache = in_array('upload_time', $requestedFields);
|
||||
|
||||
$query = $builder->selectFileCache('file', $joinExtendedCache);
|
||||
|
||||
if (in_array('systemtag', $requestedFields)) {
|
||||
$this->equipQueryForSystemTags($query, $this->requireUser($searchQuery));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -64,6 +64,7 @@ class SearchBuilder {
|
|||
'share_with' => 'string',
|
||||
'share_type' => 'integer',
|
||||
'owner' => 'string',
|
||||
'upload_time' => 'integer',
|
||||
];
|
||||
|
||||
/** @var array<string, int|string> */
|
||||
|
|
@ -257,6 +258,7 @@ class SearchBuilder {
|
|||
'share_with' => ['eq'],
|
||||
'share_type' => ['eq'],
|
||||
'owner' => ['eq'],
|
||||
'upload_time' => ['eq', 'gt', 'lt', 'gte', 'lte'],
|
||||
];
|
||||
|
||||
if (!isset(self::$fieldTypes[$operator->getField()])) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue