On Tue, Jun 9, 2015, at 05:27 PM, Chris Hostetter wrote: > > : I'm using Solr 4.10.0.I'm trying to figure out how to use the TZ > : param.I've noticed that i have to use date math in order for this to > : work,also I've got to use rounding when I query Solr in order to use > the > : TZ param. > > I'm having trouble understanding your question. The TZ param, as > documented, only affects what TimeZone is used for the purpose of > rounding > dates -- so of course, if you aren't using rounding then the TZ param > does > nothing. And since rounding is a form of date math, then yes it's also > true you must use date math for TZ to have any meaning. > > https://cwiki.apache.org/confluence/display/solr/Working+with+Dates > > : The issue is that when i query I'd like to get recent hours for my > : search, something like the query for last 1 hour. The Date Math > : supports it but the TZ works only if my rounding is DAY or more, and i > : need MINUTE rounding for my query. > > TZ affects what timezone is used when defining the concept of a "day" for > the purposes of rounding by day -- if you used a TimeZone like > TZ=Asia/Tehran you'll see the correct rounding even though that timezone > is +04:30 relative to UTC. > > : I wanted to know is it possible to use TZ feature when I'm using MINUTE > rounding? > : > : My query looks like this: > : q=*:*fq=realDate:[NOW/MINUTE-3HOURS TO > NOW/MINUTE-1MINUTES]&rows=20&NOW=1433777301000&facet.range=realDate&facet=true&facet.range.start=NOW/MINUTE-3HOURS&facet.range.end=NOW/MINUTE-1MINUTES&facet.range.gap=%2B10MINUTE&TZ=GMT > : <field name="realDate" type="tdate" indexed="true" stored="true" > required="false" multiValued="false" /> > > You've given an example of a query you are currently using -- but you > haven't given us any of hte other info we really need ot try and > understand your question (ie: what do some of the documents you've > indexed > look like? what results do you get from your query? what do you see in > those results that isn't matching your goal? what documents are matched > by > your query (or by a facet) that you don't want to be matched? what > documents aren't matched that you want to be matched? > > The best thing to do would be if you could just describe for us in words > what you want, and give a specific example -- such as "If it's 4:37PM in > my local timezone Foo/Bar, i want to send a query to Solr and have it > return results based on teh time range X to Y with facets like ...."
Hoss, So, are you saying that you are expected to store UTC dates in your index, but if you happen to know that a user is in a different timezone, you can round those dates for them according to their timezone instead of UTC? That's how I'd interpret it, but useful to confirm. Thx! Upayavira