[
https://issues.apache.org/jira/browse/SOLR-2690?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13190089#comment-13190089
]
David Schlotfeldt commented on SOLR-2690:
-----------------------------------------
Thank you Shotaro for posting that code for me. The code Shotaro posted is a
new version of faceting that makes date ranges take time zones into account
which is essential for the reasons specified above.
I also just made DateField and TrieDateField also take time zone into account.
Why do we need this? For example let's say you have "events" in solr. They have
a startDate set on them. If we want all events happening today we would want to
be able to run the query "+startDate[NOW/DAY TO NOW/DAY+1]" This query will not
work as expected since when "/DAY" rounds to the beginning of the day for
GMT+0. To solve this yes I could run "+startDate[NOW/DAY+6HOUR TO
NOW/DAY+1+6HOUR]" since i am in central timezone. BUT we have daylight savings
time so some parts of the year I need it to be +5HOUR instead of +6HOUR. The
lack of timezone support makes many date related queries that should be easy
hard.
The comment above is a patch against
https://svn.apache.org/repos/asf/lucene/dev/tags/lucene_solr_3_3 (from 8/9/2011
which is what i am running off of) that adds a "tz" parameter that causes the
DateMathParser DateField and TrieDateField uses to be configured with the
specified timezone.
(Though not posted here I also modified the component Shotaro shared with you
to use "tz" if "facet.date.tz" isn't specified.)
> Date Faceting or Range Faceting doesn't take timezone into account.
> -------------------------------------------------------------------
>
> Key: SOLR-2690
> URL: https://issues.apache.org/jira/browse/SOLR-2690
> Project: Solr
> Issue Type: Improvement
> Affects Versions: 3.3
> Reporter: David Schlotfeldt
> Attachments: add-tz-parameter.patch, timezone-facet-component.tgz
>
> Original Estimate: 3h
> Remaining Estimate: 3h
>
> Timezone needs to be taken into account when doing date math. Currently it
> isn't. DateMathParser instances created are always being constructed with
> UTC. This is a huge issue when it comes to faceting. Depending on your
> timezone day-light-savings changes the length of a month. A facet gap of
> +1MONTH is different depending on the timezone and the time of the year.
> I believe the issue is very simple to fix. There are three places in the code
> DateMathParser is created. All three are configured with the timezone being
> UTC. If a user could specify the TimeZone to pass into DateMathParser this
> faceting issue would be resolved.
> Though it would be nice if we could always specify the timezone
> DateMathParser uses (since date math DOES depend on timezone) its really only
> essential that we can affect DateMathParser the SimpleFacets uses when
> dealing with the gap of the date facets.
> Another solution is to expand the syntax of the expressions DateMathParser
> understands. For example we could allow "(?timeZone=VALUE)" to be added
> anywhere within an expression. VALUE would be the id of the timezone. When
> DateMathParser reads this in sets the timezone on the Calendar it is using.
> Two examples:
> - "(?timeZone=America/Chicago)NOW/YEAR"
> - "(?timeZone=America/Chicago)+1MONTH"
> I would be more then happy to modify DateMathParser and provide a patch. I
> just need a committer to agree this needs to be resolved and a decision needs
> to be made on the syntax used
> Thanks!
> David
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]