Tuesday, January 29, 2008

Give us a Date, and We'll Search It

In MarkMail we like to have both a search box way to do something (easy for experts) and a graphical way to do something (easy for novices). Recently we added support for date-based query constraints. At the moment it's only available in the search box, but we thought it worth talking about anyway. A graphical version will be coming soon (we know, we can't wait to click and swipe the months on the chart either).

With the new feature you specify a date or date range by adding a date: term to a query. For example, lets say you'd like to investigate the cause of the sudden spike in messages from the PHP lists for the query "register globals". You see this histogram:

So let's satisfy that curiosity. In April of 2002 things really start to heat up and it remains a pretty hot topic until roughly November 2003. To restrict our query to these dates all we have to do is add "date:2002/04-2003/11" to our register globals query, yielding "register globals date:2002/04-2003/11". Two dates separated by a hyphen indicate a range. This gives you only the matching messages from April 2002 through November 2003. The chart even highlights the selection range:

Looking at the statistics for this query, most of the messages were posted to the discuss list so it's likely that users are having problems. We might assume that something changed with the language so let's add "release" to the query. Sure enough, looks like they changed the default behavior of register globals in the 4.2.0 release which was released on April 22nd, 2002.

We support more than just date ranges. Here's a just a few of the formats that we support:

date:todayMessages posted today
date:"last week"Messages posted in the last 7 days
date:"last month"Messages posted in the last 30 days
date:lastmonthSpaces are optional, for convenience
date:2008/01/26Selection by day
date:20080126Slashes are optional, if you prefer
date:2008/01Selection by month
date:2007Selection by year
date:2005/06-Everything from June 2005 onward, because of the trailing hyphen
date:-2005/06Everything up to the end of June 2005, because of the leading hyphen
date:2007-2008This year and last
date:"July 4th, 2007"Human readable formats are supported too
date:"Julio 4th, 2007"For all of you Spanish speakers
date:t90dMessages from the last 90 days, don't forget the t
-date:2008Negation is also allowed, put the hyphen in front of the date:

Don't worry if you can't remember all this. The question mark graphic next to the search box will pop up a reminder. So now while we continue to work on allowing you to interact with the graphs, give this a spin and let us know what you think.

P.S. Jason really likes this because it lets him examine all the changes between JDOM 1.0 and JDOM 1.1.

No comments: