Skip to content

Commit

Permalink
changed the keywords to singular
Browse files Browse the repository at this point in the history
  • Loading branch information
2403905 committed Nov 8, 2023
1 parent 27975e3 commit efab378
Show file tree
Hide file tree
Showing 11 changed files with 130 additions and 43 deletions.
86 changes: 84 additions & 2 deletions changelog/unreleased/add-file-type-filter-chip.md
@@ -1,6 +1,88 @@
Enhancement: Add "File type" filter Chip
Enhancement: Add search mimetype filter

Add "File type" filter Chip
Add filter MimeType filter shortcuts to search for specific document types.
For example, a search query MimeType: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.presentationml.presentation
application/vnd.oasis.opendocument.presentation
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
application/vnd.ms-excel

## 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
2 changes: 1 addition & 1 deletion go.mod
Expand Up @@ -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.20231031092154-9f40f0453b34
github.com/cs3org/reva/v2 v2.16.1-0.20231108120331-715bd782689f
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
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Expand Up @@ -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.20231031092154-9f40f0453b34 h1:fgJV6Ad4nMZakeFWgSnPSeReyMB1RN6PEV8jAjw3vdQ=
github.com/cs3org/reva/v2 v2.16.1-0.20231031092154-9f40f0453b34/go.mod h1:utPCNSrWDdAwz2biLrKvzO6nDH9L7vRVGNzof13r8Kw=
github.com/cs3org/reva/v2 v2.16.1-0.20231108120331-715bd782689f h1:WObbHWbihhh98V9tjjBUsIYKR3qIMDY0/9cve8KLWr4=
github.com/cs3org/reva/v2 v2.16.1-0.20231108120331-715bd782689f/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=
Expand Down
2 changes: 1 addition & 1 deletion services/frontend/pkg/revaconfig/config.go
Expand Up @@ -303,7 +303,7 @@ func FrontendConfigFromStruct(cfg *config.Config, logger log.Logger) (map[string
"enabled": false,
},
"mimetype": map[string]interface{}{
"keywords": []string{"file", "folder", "documents", "spreadsheets", "presentations", "pdfs", "images", "videos", "audio", "archives"},
"keywords": []string{"file", "folder", "document", "spreadsheet", "presentation", "pdf", "image", "video", "audio", "archive"},
"enabled": true,
},
"type": map[string]interface{}{
Expand Down
14 changes: 7 additions & 7 deletions services/search/pkg/query/bleve/compiler.go
Expand Up @@ -296,7 +296,7 @@ func mimeType(k, v string) (bleveQuery.Query, bool) {
return q, false
case "folder":
return bleveQuery.NewQueryStringQuery(k + ":httpd/unix-directory"), false
case "documents":
case "document":
return bleveQuery.NewDisjunctionQuery(newQueryStringQueryList(k,
"application/msword",
"application/vnd.openxmlformats-officedocument.wordprocessingml.document",
Expand All @@ -306,7 +306,7 @@ func mimeType(k, v string) (bleveQuery.Query, bool) {
"application/rtf",
"application/vnd.apple.pages",
)), true
case "spreadsheets":
case "spreadsheet":
return bleveQuery.NewDisjunctionQuery(newQueryStringQueryList(k,
"application/vnd.ms-excel",
"application/vnd.oasis.opendocument.spreadsheet",
Expand All @@ -317,7 +317,7 @@ func mimeType(k, v string) (bleveQuery.Query, bool) {
"application/vnd.oasis.opendocument.spreadsheet",
"application/vnd.apple.numbers",
)), true
case "presentations":
case "presentation":
return bleveQuery.NewDisjunctionQuery(newQueryStringQueryList(k,
"application/vnd.ms-excel",
"application/vnd.oasis.opendocument.spreadsheet",
Expand All @@ -328,15 +328,15 @@ func mimeType(k, v string) (bleveQuery.Query, bool) {
"application/vnd.oasis.opendocument.spreadsheet",
"application/vnd.apple.numbers",
)), true
case "pdfs":
case "pdf":
return bleveQuery.NewQueryStringQuery(k + ":application/pdf"), false
case "images":
case "image":
return bleveQuery.NewQueryStringQuery(k + ":image/*"), false
case "videos":
case "video":
return bleveQuery.NewQueryStringQuery(k + ":video/*"), false
case "audio":
return bleveQuery.NewQueryStringQuery(k + ":audio/*"), false
case "archives":
case "archive":
return bleveQuery.NewDisjunctionQuery(newQueryStringQueryList(k,
"application/zip",
"application/x-tar",
Expand Down
26 changes: 13 additions & 13 deletions services/search/pkg/query/bleve/compiler_test.go
Expand Up @@ -387,10 +387,10 @@ func Test_compile(t *testing.T) {
wantErr: false,
},
{
name: `MimeType:documents`,
name: `MimeType:document`,
args: &ast.Ast{
Nodes: []ast.Node{
&ast.StringNode{Key: "mimetype", Value: "documents"},
&ast.StringNode{Key: "mimetype", Value: "document"},
},
},
want: query.NewDisjunctionQuery([]query.Query{
Expand All @@ -405,10 +405,10 @@ func Test_compile(t *testing.T) {
wantErr: false,
},
{
name: `MimeType:documents AND *tdd*`,
name: `MimeType:document AND *tdd*`,
args: &ast.Ast{
Nodes: []ast.Node{
&ast.StringNode{Key: "mimetype", Value: "documents"},
&ast.StringNode{Key: "mimetype", Value: "document"},
&ast.OperatorNode{Value: "AND"},
&ast.StringNode{Key: "name", Value: "*tdd*"},
},
Expand All @@ -428,12 +428,12 @@ func Test_compile(t *testing.T) {
wantErr: false,
},
{
name: `MimeType:documents OR MimeType:pdfs AND *tdd*`,
name: `MimeType:document OR MimeType:pdf AND *tdd*`,
args: &ast.Ast{
Nodes: []ast.Node{
&ast.StringNode{Key: "mimetype", Value: "documents"},
&ast.StringNode{Key: "mimetype", Value: "document"},
&ast.OperatorNode{Value: "OR"},
&ast.StringNode{Key: "mimetype", Value: "pdfs"},
&ast.StringNode{Key: "mimetype", Value: "pdf"},
&ast.OperatorNode{Value: "AND"},
&ast.StringNode{Key: "name", Value: "*tdd*"},
},
Expand All @@ -454,13 +454,13 @@ func Test_compile(t *testing.T) {
wantErr: false,
},
{
name: `(MimeType:documents OR MimeType:pdfs) AND *tdd*`,
name: `(MimeType:document OR MimeType:pdf) AND *tdd*`,
args: &ast.Ast{
Nodes: []ast.Node{
&ast.GroupNode{Nodes: []ast.Node{
&ast.StringNode{Key: "mimetype", Value: "documents"},
&ast.StringNode{Key: "mimetype", Value: "document"},
&ast.OperatorNode{Value: "OR"},
&ast.StringNode{Key: "mimetype", Value: "pdfs"},
&ast.StringNode{Key: "mimetype", Value: "pdf"},
}},
&ast.OperatorNode{Value: "AND"},
&ast.StringNode{Key: "name", Value: "*tdd*"},
Expand All @@ -482,13 +482,13 @@ func Test_compile(t *testing.T) {
wantErr: false,
},
{
name: `(MimeType:pdfs OR MimeType:documents) AND *tdd*`,
name: `(MimeType:pdf OR MimeType:document) AND *tdd*`,
args: &ast.Ast{
Nodes: []ast.Node{
&ast.GroupNode{Nodes: []ast.Node{
&ast.StringNode{Key: "mimetype", Value: "pdfs"},
&ast.StringNode{Key: "mimetype", Value: "pdf"},
&ast.OperatorNode{Value: "OR"},
&ast.StringNode{Key: "mimetype", Value: "documents"},
&ast.StringNode{Key: "mimetype", Value: "document"},
}},
&ast.OperatorNode{Value: "AND"},
&ast.StringNode{Key: "name", Value: "*tdd*"},
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion vendor/modules.txt
Expand Up @@ -357,7 +357,7 @@ github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1
github.com/cs3org/go-cs3apis/cs3/storage/registry/v1beta1
github.com/cs3org/go-cs3apis/cs3/tx/v1beta1
github.com/cs3org/go-cs3apis/cs3/types/v1beta1
# github.com/cs3org/reva/v2 v2.16.1-0.20231031092154-9f40f0453b34
# github.com/cs3org/reva/v2 v2.16.1-0.20231108120331-715bd782689f
## explicit; go 1.20
github.com/cs3org/reva/v2/cmd/revad/internal/grace
github.com/cs3org/reva/v2/cmd/revad/runtime
Expand Down

0 comments on commit efab378

Please sign in to comment.