symmetryinvestments / imap-d

D library for IMAP (JMAP is a work-in-progress but the basics work)
14 stars 10 forks source link

Update structured search query expressions. #61

Closed otrho closed 3 years ago

otrho commented 3 years ago

OK, this has been tricky and has taken me a couple of weeks to work through. It still has a couple of bits missing but I think it's at a good place.

The biggest difference is search queries are now arbitrarily composable. There are basic terms like seen or subject("foobar") and they can be joined with boolean operations and, or and not.

In D it's pretty verbose though. You can see in the unittests in searchquery.d. I'm not sure if this is a problem or if it can be made less verbose; I'm still not 100% up to speed with idiomatic D.

In SIL it's less verbose and I think quite OK. By using import * from imap.query each of the terms and operators are brought into immediate scope and creating a search query expression is fairly straight forward and much simpler than trying to document the SEARCH syntax from RFC3501.

otrho commented 3 years ago

I'd really like to merge this and then push a new package and then get it into the SIL stdlib.