You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by vybe3142 <vy...@gmail.com> on 2012/04/18 20:11:37 UTC

Date granularity

A query search on a particular date:

returns 1valid result (as expected).

How can I alter the granularity of the search for example , to all matches
on the particular DAY?

Reading through various docs, I attempt to append "/DAY" but this doesn't
seem to work (in fact I get 0 results back when querying).

What am I neglecting? 
Thanks



--
View this message in context: http://lucene.472066.n3.nabble.com/Date-granularity-tp3920890p3920890.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Date granularity

Posted by vybe3142 <vy...@gmail.com>.
Thanks

So , I tried out the suggestions. I used the main query though (not a
filter)
1. Using a DATE range  and DAYdoes give me the desired results.
Specifically, the query that I used was

2. Without a DATE range, the parser seems to reduce the date to the
beginning of the day i.e. 00:00:00 and attempt to find docs matching that
doc exactly (at least that's what it appears to do, from the debugs). 

Although the range query appears to work,  isn't there a more elegant way to
specify a granular query without having to use a range? Debug output
attached

Thanks


http://lucene.472066.n3.nabble.com/file/n3923651/datedebug.txt datedebug.txt 

--
View this message in context: http://lucene.472066.n3.nabble.com/Date-granularity-tp3920890p3923651.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Date granularity

Posted by Erick Erickson <er...@gmail.com>.
Well, that's just the way Solr works. You can tune the range
performance by playing with the prescisionStep, Trie
fields are built to make range queries perform well.

Best
Erick

On Fri, Apr 20, 2012 at 10:20 AM, vybe3142 <vy...@gmail.com> wrote:
> ... Inelegant as opposed to the possibility of using /DAY to specify day
> granularity on a single term query
>
> In any case, if that's how SOLR works, that's fine
>
> Any rough idea of the performance of range queries vs truncated day queries?
> Otherwise, I might just write up a quick program to compare them
>
> Thanks
>
>
> --
> View this message in context: http://lucene.472066.n3.nabble.com/Date-granularity-tp3920890p3926165.html
> Sent from the Solr - User mailing list archive at Nabble.com.

Re: Date granularity

Posted by vybe3142 <vy...@gmail.com>.
... Inelegant as opposed to the possibility of using /DAY to specify day
granularity on a single term query

In any case, if that's how SOLR works, that's fine

Any rough idea of the performance of range queries vs truncated day queries?
Otherwise, I might just write up a quick program to compare them

Thanks


--
View this message in context: http://lucene.472066.n3.nabble.com/Date-granularity-tp3920890p3926165.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Date granularity

Posted by Erick Erickson <er...@gmail.com>.
The only way to get more "elegant" would be to
index the dates with the granularity you want, i.e.
truncate to DAY at index time then truncate
to DAY at query time as well.

Why do you consider ranges inelegant? How else
would you imagine it would be done?

Best
Erick

On Thu, Apr 19, 2012 at 4:07 PM, vybe3142 <vy...@gmail.com> wrote:
> Also, what's the performance impact of range queries vs. querying for a
> particular DAY (as described in my last post)  when the index contains ,
> say, 10 million docs ?
>
> If the range queries result in a significant performance hit, one option for
> us would be to define additional DAY fields when indexing TIME data
> eg. when indexing METADATA.DATE_ABC= 2009-07-31T15:25:45Z , also create and
> index something like METADATA.DATE_DAY_ABC= 2009-07-31T00:005:00Z
>
>
>
> --
> View this message in context: http://lucene.472066.n3.nabble.com/Date-granularity-tp3920890p3924290.html
> Sent from the Solr - User mailing list archive at Nabble.com.

Re: Date granularity

Posted by vybe3142 <vy...@gmail.com>.
Also, what's the performance impact of range queries vs. querying for a
particular DAY (as described in my last post)  when the index contains ,
say, 10 million docs ?

If the range queries result in a significant performance hit, one option for
us would be to define additional DAY fields when indexing TIME data
eg. when indexing METADATA.DATE_ABC= 2009-07-31T15:25:45Z , also create and
index something like METADATA.DATE_DAY_ABC= 2009-07-31T00:005:00Z



--
View this message in context: http://lucene.472066.n3.nabble.com/Date-granularity-tp3920890p3924290.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Date granularity

Posted by Erick Erickson <er...@gmail.com>.
If Peter's suggestion doesn't work, please post the results
of adding &debugQuery=on to your query. The date math
stuff is sensitive to spaces, for instance and it's impossible
to tell whether you're making a simple error like that without
seeing what you're actually doing.

Best
Erick

On Wed, Apr 18, 2012 at 6:46 PM, Peter Markey <su...@gmail.com> wrote:
> you could use a filter query like: fq=datefield:[NOW/DAY-1DAY TO
> NOW/DAY+1DAY]
>
> *replace datefield with your field that contains the time info
>
> On Wed, Apr 18, 2012 at 11:11 AM, vybe3142 <vy...@gmail.com> wrote:
>
>> A query search on a particular date:
>>
>> returns 1valid result (as expected).
>>
>> How can I alter the granularity of the search for example , to all matches
>> on the particular DAY?
>>
>> Reading through various docs, I attempt to append "/DAY" but this doesn't
>> seem to work (in fact I get 0 results back when querying).
>>
>> What am I neglecting?
>> Thanks
>>
>>
>>
>> --
>> View this message in context:
>> http://lucene.472066.n3.nabble.com/Date-granularity-tp3920890p3920890.html
>> Sent from the Solr - User mailing list archive at Nabble.com.
>>

Re: Date granularity

Posted by Peter Markey <su...@gmail.com>.
you could use a filter query like: fq=datefield:[NOW/DAY-1DAY TO
NOW/DAY+1DAY]

*replace datefield with your field that contains the time info

On Wed, Apr 18, 2012 at 11:11 AM, vybe3142 <vy...@gmail.com> wrote:

> A query search on a particular date:
>
> returns 1valid result (as expected).
>
> How can I alter the granularity of the search for example , to all matches
> on the particular DAY?
>
> Reading through various docs, I attempt to append "/DAY" but this doesn't
> seem to work (in fact I get 0 results back when querying).
>
> What am I neglecting?
> Thanks
>
>
>
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/Date-granularity-tp3920890p3920890.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>