Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add last modified filter chip #7455

Merged
merged 2 commits into from Oct 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 7 additions & 0 deletions changelog/unreleased/add-last-modified-filter-chip.md
@@ -0,0 +1,7 @@
Enhancement: Add "Last modified" filter Chip

Add "Last modified" filter Chip

https://github.com/owncloud/ocis/issues/7431
micbar marked this conversation as resolved.
Show resolved Hide resolved
https://github.com/owncloud/ocis/pull/7455

52 changes: 52 additions & 0 deletions services/frontend/pkg/revaconfig/config.go
Expand Up @@ -289,6 +289,58 @@ func FrontendConfigFromStruct(cfg *config.Config, logger log.Logger) (map[string
"share_jail": cfg.EnableShareJail,
"max_quota": cfg.MaxQuota,
},
"search": map[string]interface{}{
"property": []map[string]interface{}{
{
"name": []map[string]interface{}{
{
"enabled": true,
},
},
"mtime": []map[string]interface{}{
{
"keywords": []string{"today", "yesterday", "this week", "last week", "last 7 days", "this month", "last month", "last 30 days", "this year", "last year"},
"enabled": true,
},
},
"size": []map[string]interface{}{
{
"enabled": false,
},
},
"mimetype": []map[string]interface{}{
{
"enabled": true,
},
},
"type": []map[string]interface{}{
{
"enabled": true,
},
},
"tag": []map[string]interface{}{
{
"enabled": true,
},
},
"tags": []map[string]interface{}{
{
"enabled": true,
},
},
"content": []map[string]interface{}{
{
"enabled": true,
},
},
"scope": []map[string]interface{}{
{
"enabled": true,
},
},
},
},
},
"password_policy": map[string]interface{}{
"max_characters": 72,
"min_characters": cfg.PasswordPolicy.MinCharacters,
Expand Down
10 changes: 10 additions & 0 deletions services/search/pkg/query/kql/cast.go
Expand Up @@ -104,13 +104,23 @@ func toTimeRange(in interface{}) (*time.Time, *time.Time, error) {
case "this week":
from = n.BeginningOfWeek()
to = n.EndOfWeek()
case "last week":
lastWeek := n.With(n.AddDate(0, 0, -7))
from = lastWeek.BeginningOfWeek()
to = lastWeek.EndOfWeek()
case "last 7 days":
from = n.With(n.AddDate(0, 0, -6)).BeginningOfDay()
to = n.EndOfDay()
case "this month":
from = n.BeginningOfMonth()
to = n.EndOfMonth()
case "last month":
lastMonth := n.With(n.AddDate(0, -1, 0))
from = lastMonth.BeginningOfMonth()
to = lastMonth.EndOfMonth()
case "last 30 days":
from = n.With(n.AddDate(0, 0, -29)).BeginningOfDay()
to = n.EndOfDay()
case "this year":
from = n.BeginningOfYear()
to = n.EndOfYear()
Expand Down
3 changes: 3 additions & 0 deletions services/search/pkg/query/kql/dictionary.peg
Expand Up @@ -200,8 +200,11 @@ NaturalLanguageDateTime <-
"today" /
"yesterday" /
"this week" /
"last week" /
"last 7 days" /
"this month" /
"last month" /
"last 30 days" /
"this year" /
"last year" {
return c.text, nil
Expand Down