diff --git a/changelog/unreleased/add-file-type-filter-chip.md b/changelog/unreleased/add-file-type-filter-chip.md new file mode 100644 index 000000000..32da27816 --- /dev/null +++ b/changelog/unreleased/add-file-type-filter-chip.md @@ -0,0 +1,85 @@ +Enhancement: Add search MediaType filter + +Add filter MediaType filter shortcuts to search for specific document types. +For example, a search query mediatype:documents will search for files with the following mimetypes: + +application/msword +MimeType:application/vnd.openxmlformats-officedocument.wordprocessingml.document +MimeType:application/vnd.oasis.opendocument.text +MimeType:text/plain +MimeType:text/markdown +MimeType:application/rtf +MimeType:application/vnd.apple.pages + +besides the document shorthand, it also contains following: + +* file +* folder +* document +* spreadsheet +* presentation +* pdf +* image +* video +* audio +* archive + +## File + +## Folder + +## Document: + +application/msword +application/vnd.openxmlformats-officedocument.wordprocessingml.document +application/vnd.oasis.opendocument.text +text/plain +text/markdown +application/rtf +application/vnd.apple.pages + +## Spreadsheet: + +application/vnd.ms-excel +application/vnd.oasis.opendocument.spreadsheet +text/csv +application/vnd.openxmlformats-officedocument.spreadsheetml.sheet +application/vnd.oasis.opendocument.spreadsheet +application/vnd.apple.numbers + +## Presentations: + +application/vnd.ms-powerpoint +application/vnd.openxmlformats-officedocument.presentationml.presentation +application/vnd.oasis.opendocument.presentation +application/vnd.apple.keynote + +## PDF + +application/pdf + +## Image: + +image/* + +## Video: + +video/* + +## Audio: + +audio/* + +## Archive (zip ...): + +application/zip +application/x-tar +application/x-gzip +application/x-7z-compressed +application/x-rar-compressed +application/x-bzip2 +application/x-bzip +application/x-tgz + +https://github.com/owncloud/ocis/pull/7602 +https://github.com/owncloud/ocis/issues/7432 diff --git a/go.mod b/go.mod index 2d4c86bbe..74c1350de 100644 --- a/go.mod +++ b/go.mod @@ -13,7 +13,7 @@ require ( github.com/coreos/go-oidc v2.2.1+incompatible github.com/coreos/go-oidc/v3 v3.7.0 github.com/cs3org/go-cs3apis v0.0.0-20231023073225-7748710e0781 - github.com/cs3org/reva/v2 v2.16.1-0.20231107141341-4b08a8b754e7 + github.com/cs3org/reva/v2 v2.16.1-0.20231110061744-953e57a6a95c github.com/dhowden/tag v0.0.0-20230630033851-978a0926ee25 github.com/disintegration/imaging v1.6.2 github.com/dutchcoders/go-clamd v0.0.0-20170520113014-b970184f4d9e diff --git a/go.sum b/go.sum index 61d1cef48..14d62add7 100644 --- a/go.sum +++ b/go.sum @@ -1013,8 +1013,8 @@ github.com/crewjam/saml v0.4.14 h1:g9FBNx62osKusnFzs3QTN5L9CVA/Egfgm+stJShzw/c= github.com/crewjam/saml v0.4.14/go.mod h1:UVSZCf18jJkk6GpWNVqcyQJMD5HsRugBPf4I1nl2mME= github.com/cs3org/go-cs3apis v0.0.0-20231023073225-7748710e0781 h1:BUdwkIlf8IS2FasrrPg8gGPHQPOrQ18MS1Oew2tmGtY= github.com/cs3org/go-cs3apis v0.0.0-20231023073225-7748710e0781/go.mod h1:UXha4TguuB52H14EMoSsCqDj7k8a/t7g4gVP+bgY5LY= -github.com/cs3org/reva/v2 v2.16.1-0.20231107141341-4b08a8b754e7 h1:NmISK1T/c/1hDfOiGqPEVAOq3BTxWzIe2+bn3TtrzzU= -github.com/cs3org/reva/v2 v2.16.1-0.20231107141341-4b08a8b754e7/go.mod h1:utPCNSrWDdAwz2biLrKvzO6nDH9L7vRVGNzof13r8Kw= +github.com/cs3org/reva/v2 v2.16.1-0.20231110061744-953e57a6a95c h1:sxTOKm1ChsykAm8ITLHXNSic9RTUfpAq6Ujj94/irXQ= +github.com/cs3org/reva/v2 v2.16.1-0.20231110061744-953e57a6a95c/go.mod h1:utPCNSrWDdAwz2biLrKvzO6nDH9L7vRVGNzof13r8Kw= github.com/cyberdelia/templates v0.0.0-20141128023046-ca7fffd4298c/go.mod h1:GyV+0YP4qX0UQ7r2MoYZ+AvYDp12OF5yg4q8rGnyNh4= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= diff --git a/services/frontend/pkg/revaconfig/config.go b/services/frontend/pkg/revaconfig/config.go index 360e7aff6..cef10f4ab 100644 --- a/services/frontend/pkg/revaconfig/config.go +++ b/services/frontend/pkg/revaconfig/config.go @@ -302,8 +302,9 @@ func FrontendConfigFromStruct(cfg *config.Config, logger log.Logger) (map[string "size": map[string]interface{}{ "enabled": false, }, - "mimetype": map[string]interface{}{ - "enabled": true, + "mediatype": map[string]interface{}{ + "keywords": []string{"file", "folder", "document", "spreadsheet", "presentation", "pdf", "image", "video", "audio", "archive"}, + "enabled": true, }, "type": map[string]interface{}{ "enabled": true, diff --git a/services/search/pkg/query/bleve/compiler.go b/services/search/pkg/query/bleve/compiler.go index c7b1c70d8..7464211a1 100644 --- a/services/search/pkg/query/bleve/compiler.go +++ b/services/search/pkg/query/bleve/compiler.go @@ -6,24 +6,23 @@ import ( "github.com/blevesearch/bleve/v2" bleveQuery "github.com/blevesearch/bleve/v2/search/query" - "github.com/owncloud/ocis/v2/services/search/pkg/query/ast" "github.com/owncloud/ocis/v2/services/search/pkg/query/kql" ) var _fields = map[string]string{ - "rootid": "RootID", - "path": "Path", - "id": "ID", - "name": "Name", - "size": "Size", - "mtime": "Mtime", - "mimetype": "MimeType", - "type": "Type", - "tag": "Tags", - "tags": "Tags", - "content": "Content", - "hidden": "Hidden", + "rootid": "RootID", + "path": "Path", + "id": "ID", + "name": "Name", + "size": "Size", + "mtime": "Mtime", + "mediatype": "MimeType", + "type": "Type", + "tag": "Tags", + "tags": "Tags", + "content": "Content", + "hidden": "Hidden", } // The following quoted string enumerates the characters which may be escaped: "+-=&|>