RE: Query time only Ranges
: Actually I needed time upto seconds granularity, so did you mean I : should index the field after conversion into seconds it doesnt' relaly matter what granularity you need -- the point is if you need to query for things based on time of day, independent of hte actual date, then the best way to do this is probably to ignore the Solr DateField completely and just use a numeric field to index some unit of time as a number (it doesn't matter wether it's hours, minutes, seconds, or milliseconds -- use whatever makes hte most sense for your needs) : if you only need to store the hour of the day, and query on the hour of : the day, then i would just use a numeric integer field containing the hour : of the day. : : if you want minute or second (even even millisecond) granularity, but you : still only care abotu the time of day (and note the *date*) then i would : still use an integer field, and just index the numeric value in whatever : granualrity you need. -Hoss
RE: Query time only Ranges
Hi Chris, Actually I needed time upto seconds granularity, so did you mean I should index the field after conversion into seconds Ankit -Original Message- From: Chris Hostetter [mailto:hossman_luc...@fucit.org] Sent: Wednesday, March 31, 2010 10:05 PM To: solr-user@lucene.apache.org Subject: Re: Query time only Ranges : I am working on use case - wherein i need to Query to just time ranges : without date component. : : search for docs with between 4pm - 6pm if you only need to store the hour of the day, and query on the hour of the day, then i would just use a numeric integer field containing the hour of the day. if you want minute or second (even even millisecond) granularity, but you still only care abotu the time of day (and note the *date*) then i would still use an integer field, and just index the numeric value in whatever granualrity you need. -Hoss
Re: Query time only Ranges
: I am working on use case - wherein i need to Query to just time ranges : without date component. : : search for docs with between 4pm - 6pm if you only need to store the hour of the day, and query on the hour of the day, then i would just use a numeric integer field containing the hour of the day. if you want minute or second (even even millisecond) granularity, but you still only care abotu the time of day (and note the *date*) then i would still use an integer field, and just index the numeric value in whatever granualrity you need. -Hoss
Re: Query time only Ranges
In that case, you could just calculate an offset from 00:00:00 in seconds (ignore the date) Pretty simple. On Wed, Mar 31, 2010 at 4:57 PM, abhatna...@vantage.com wrote: > > Hi Sashi, > Could you elaborate point no .1 in the light of case where in a field should > have just time? > > > Ankit > > > -- > View this message in context: > http://n3.nabble.com/Query-time-only-Ranges-tp688831p689413.html > Sent from the Solr - User mailing list archive at Nabble.com. >
Re: Query time only Ranges
Hi Sashi, Could you elaborate point no .1 in the light of case where in a field should have just time? Ankit -- View this message in context: http://n3.nabble.com/Query-time-only-Ranges-tp688831p689413.html Sent from the Solr - User mailing list archive at Nabble.com.
Re: Query time only Ranges
I suggest approaching it thus: 1. Create a datetime offset from a baseline date (say Jan 1, 1900, 00:00:00) and store the date diff in secs from that date-time. 2. Use numeric range query. I find this approach works faster and would also give you the granularity you want. On Wed, Mar 31, 2010 at 4:40 PM, abhatna...@vantage.com wrote: > > One issue though – first I need precision upto seconds. > > Also does anybody knows that performance issue involved with this > granularity. > > How about the approach of breaking date time field into fields like hours, > mins, secs > > > > Ankit > -- > View this message in context: > http://n3.nabble.com/Query-time-only-Ranges-tp688831p689373.html > Sent from the Solr - User mailing list archive at Nabble.com. >
Re: Query time only Ranges
One issue though – first I need precision upto seconds. Also does anybody knows that performance issue involved with this granularity. How about the approach of breaking date time field into fields like hours, mins, secs Ankit -- View this message in context: http://n3.nabble.com/Query-time-only-Ranges-tp688831p689373.html Sent from the Solr - User mailing list archive at Nabble.com.
Re: Query time only Ranges
Small typo..Corrected and sending.. the query - [01/01/1900T16:43:42Z/HOUR TO 01/01/1900T18:55:23Z/HOUR ] would be equivalent to [01/01/1900T16:00:00Z TO 01/01/1900T18:00:00Z] Thx, Tiru - Original Message From: Silent Surfer To: solr-user@lucene.apache.org Sent: Wed, March 31, 2010 12:36:22 PM Subject: Re: Query time only Ranges Hi Ankit, Try the following approach. create a query like - [01/01/1900T16:00:00Z/HOUR TO 01/01/1900T18:00:00Z/HOUR ] Solr will automatically will take care of Rounding off to the HOUR specified. For eg: the query - [01/01/1900T16:43:42Z/HOUR TO 01/01/1900T18:55:23Z/HOUR ] would be equivalent to [01/01/1900T16:00:00Z/HOUR TO 01/01/1900T18:00:00Z/HOUR ] Regards, sS - Original Message From: "abhatna...@vantage.com" To: solr-user@lucene.apache.org Sent: Wed, March 31, 2010 9:56:38 AM Subject: Query time only Ranges Hi All, I am working on use case - wherein i need to Query to just time ranges without date component. search for docs with between 4pm - 6pm Approaches- create something like - [01/01/1900T16:00:00Z TO 01/01/1900T18:00:00Z ] - a fixed time component or create a field for hh only or may be create a custom field for Time only Please suggest me which will be a good approach or any other approach if possible Ankit -- View this message in context: http://n3.nabble.com/Query-time-only-Ranges-tp688831p688831.html Sent from the Solr - User mailing list archive at Nabble.com.
Re: Query time only Ranges
Hi Ankit, Try the following approach. create a query like - [01/01/1900T16:00:00Z/HOUR TO 01/01/1900T18:00:00Z/HOUR ] Solr will automatically will take care of Rounding off to the HOUR specified. For eg: the query - [01/01/1900T16:43:42Z/HOUR TO 01/01/1900T18:55:23Z/HOUR ] would be equivalent to [01/01/1900T16:00:00Z/HOUR TO 01/01/1900T18:00:00Z/HOUR ] Regards, sS - Original Message From: "abhatna...@vantage.com" To: solr-user@lucene.apache.org Sent: Wed, March 31, 2010 9:56:38 AM Subject: Query time only Ranges Hi All, I am working on use case - wherein i need to Query to just time ranges without date component. search for docs with between 4pm - 6pm Approaches- create something like - [01/01/1900T16:00:00Z TO 01/01/1900T18:00:00Z ] - a fixed time component or create a field for hh only or may be create a custom field for Time only Please suggest me which will be a good approach or any other approach if possible Ankit -- View this message in context: http://n3.nabble.com/Query-time-only-Ranges-tp688831p688831.html Sent from the Solr - User mailing list archive at Nabble.com.
Query time only Ranges
Hi All, I am working on use case - wherein i need to Query to just time ranges without date component. search for docs with between 4pm - 6pm Approaches- create something like - [01/01/1900T16:00:00Z TO 01/01/1900T18:00:00Z ] - a fixed time component or create a field for hh only or may be create a custom field for Time only Please suggest me which will be a good approach or any other approach if possible Ankit -- View this message in context: http://n3.nabble.com/Query-time-only-Ranges-tp688831p688831.html Sent from the Solr - User mailing list archive at Nabble.com.