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

Email/Query support combination of filters with the FilterOperator (AND, OR, NOT) #3725

Closed
remk opened this issue Sep 1, 2020 · 8 comments
Closed
Assignees
Labels
V Time spent (5 halth day)
Milestone

Comments

@remk
Copy link
Member

remk commented Sep 1, 2020

WHY

As an user i want to be able to build complex query using the FilterOperators (AND, OR, NOT)

[[ "Email/query",{
  "accountId": "ue150411c",
  "filter":  {
      "operator": "OR",
      "conditions": [
      { "inMailbox":  "mailbox1"}, {"inMailbox":  "mailbox2"}   
]
}
}, "0" ]]

###HOW

  • in the request accept the filter with an 'operator' field and distinguish it from the simple Condition.
    This should be handled in the Json reads. And build a tree which have nodes being FilterOperator and leaf being FilterConditions.
  • translate those elastic search query

DOD

  • write an integration test demonstrating the support of one level of Operator (like in the previous example)
  • write an integration test demonstrating the support of an arbitrary level of nesting Operators.
  • run those tests against the distributed version of james.
@chibenwa
Copy link
Member

chibenwa commented Sep 1, 2020

How this combines with inMailboxes, notInMailboxes filters? What do we actually allow here?

@rouazana
Copy link

rouazana commented Sep 1, 2020

How this combines with inMailboxes, notInMailboxes filters? What do we actually allow here?

I don't see any issue regarding this, do you have specific examples?

@rouazana
Copy link

rouazana commented Sep 1, 2020

Is implicit AND handled in this ticket?

for example

[[ "Email/query",{
  "accountId": "ue150411c",
  "filter":  { "inMailbox":  "mailbox1", "inMailboxOtherThan":  "mailbox2"}   
}, "0" ]]

@rouazana
Copy link

rouazana commented Sep 1, 2020

How this combines with inMailboxes, notInMailboxes filters? What do we actually allow here?

I don't see any issue regarding this, do you have specific examples?

The worst example I see regarding this is:

[[ "Email/query",{
  "accountId": "ue150411c",
  "filter":  { "inMailbox":  "mailbox1", "inMailboxOtherThan":  "mailbox1"}   
}, "0" ]]

If message1 is in mailbox1 and mailbox2, I guess this filter should return message1 as it is in mailbox1, and it is also in a mailbox other than mailbox1.
If message2 is only in mailbox1, it should not be returned by this query.

@chibenwa
Copy link
Member

chibenwa commented Sep 1, 2020

(I think it should be handled here, and I also think your example is misleading as no email will match both of these contraint. We will likely forbid to specify inMailbox & inMailboxOtherThan at the same time)

@rouazana
Copy link

rouazana commented Sep 1, 2020

(I think it should be handled here, and I also think your example is misleading as no email will match both of these contraint. We will likely forbid to specify inMailbox & inMailboxOtherThan at the same time)

My example is perfectly valid, don't forget that "inMailboxOtherThan" is different of "notInMailbox". It's not the same meaning. In this case

[[ "Email/query",{
  "accountId": "ue150411c",
  "filter":  { "inMailbox":  "mailbox1", "inMailboxOtherThan":  "mailbox2"}   
}, "0" ]]

would simple return all emails that are at least present in mailbox1. In this specific case "inMailboxOtherThan" is useless but think of it as a way to exclude trash/spam folder for some search.

@rouazana
Copy link

rouazana commented Sep 1, 2020

implicit AND is handled into #3714

@chibenwa chibenwa added this to the Sprint 2 milestone Sep 3, 2020
@chibenwa chibenwa added the IV Time spent (4 halth day) label Sep 29, 2020
@chibenwa
Copy link
Member

@chibenwa chibenwa self-assigned this Sep 30, 2020
@chibenwa chibenwa added V Time spent (5 halth day) and removed IV Time spent (4 halth day) labels Oct 1, 2020
@Arsnael Arsnael closed this as completed Oct 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
V Time spent (5 halth day)
Projects
None yet
4 participants