Zimbra offers Open Source email server software and shared calendar for Linux and the Mac
Go Back   Zimbra :: Forums > Zimbra Collaboration Suite > Users

Welcome to the Zimbra :: Forums!
Welcome, if you would like to post a comment please register. We also encourage you to explore all things Zimbra with our team and members of the community.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-04-2008, 04:04 AM
Advanced Member
 
Posts: 238
Default date:-0month ???

Today is 4th Apr 2008, my search string is date:-0month, the results show mails from 25th Mar to today, the last 10 days. date:-1month gives mail from 25th Apr to 24th Mar. What is this fixation with the 25th of the month. I would have thought date:-0month would give mails from 4th Mar to today, 4th Apr.

5.0.4 F7
Reply With Quote
  #2 (permalink)  
Old 04-04-2008, 03:19 PM
Zimbra Employee
 
Posts: 93
Default

Two separate things going on here:

1) Looks like there's a bug with "month" and "year" relative operations -- we're not zeroing out the range correctly (#$*! Java Calendar APIs, some fields are 0-indexed and some are 1-indexed and so easy to get them mixed up). I've filed bug 26744 on this.



2) Your comment "I would have thought date:-0month would give mails from 4th Mar to today, 4th Apr" is not correct because you aren't taking into account the matching window. It's important to understand that the "date" operator has an implicit matching window. When you specify date: you don't really mean an exact time, you really mean some kind of a range. Sometimes you want to refer to a calendar day (midnight-midnight), sometimes an hour (3:00 to 4:00), sometimes a week (sunday-sunday), etc. In order to take this into account, when you specify a relative date the granularity of the range is implied by the operator you use.

The reason for this will become clear if you look at the most common cases. Lets assume that the current date is 4/4/2008 and the time is 2:36pm.

Code:
date:-1h  "last hour"  -- 1pm - 2pm on 4/4
date:-1d  "yesteday"  -- midnight on 4/3 until midnight on 4/4
date:-1w "last week" -- Sunday 3/23 to Sunday 3/30
date:-1m "last month" -- 3/1 to 4/1
date:-1y "last year"   --  2007
Remember the goal here is not to create something infinitely expressible (you can always just enter "date:>=3/4/2008 and date:<=3/5/2008" and take complete control over the range yourself) but instead to allow people to quickly specify searches they have might have to do.

So date:-0m should mean "4/1 to 5/1"....but it's broken (bug 26744 ). If you really really want the exact day that happened a month ago, you want "-31d" (or -30d or -28d, depending on the month) -- there's no way to express it directly in a relative date...although honestly I don't think it's that useful (do you have a real-world use case for this?)

Now -- just because I'm on a roll -- let's see what happens when you use a relative date with the "before" or "after" operators:

Code:
after:-1d means "after yesterday" -- so today or later
after:-2h means "after the hour that was 2 hours ago" -- so after 1:00 (0 hours ago is 2-3, 1 hour ago is 1-2, so 2 hours ago is 12-1) 
after:-1y means "date:>=1/1/2008"
after:-31d means "date:>=3/5/2008"
after:-1m means "date:>=4/1/2008"
The last two are counterintuitive, but correct. "-31d" evaluates to the range (3/4/2008 0:00 to 3/5/2008 0:00) and after means ">= the end of the range.". This is easiest to grok if you think that "-1d" means "yesterday" so after:-1d means "after yesterday". For after:-1m you're talking about "After last month" which is "this month".
__________________
Bugzilla - Wiki - Downloads - Before posting... Search!
Reply With Quote
  #3 (permalink)  
Old 04-06-2008, 12:15 AM
Advanced Member
 
Posts: 238
Default

Thanks for your detailed reply. You mention bug 26744, if this means that when the bug is rectified that right now, April, date:-0month will give me all emails in April then great, date:-1month gives me emails in March, again that's good. I know that all queries need a range it was just weird that it seems that the 25th seemed to play a part in this. I was expecting the range to be defined something like now() - xdays with now() being the definitive start point.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads

Why Join?

Registering let's you ask questions, makes it easier to search, displays any files attached to posts, and notifies you about replies.

blog.zimbra.com




 

SEO by vBSEO ©2011, Crawlability, Inc.