You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@solr.apache.org by Taisuke Miyazaki <mi...@lifull.com> on 2021/09/27 11:13:32 UTC

The relationship between filter cache and date math syntax

Hi.

In fistSearcher and newSearcher, you can set up a query to warm up the
cache.
So, if I write a query like timelimit:[NOW/DAY TO NOW+7DAYS/DAY] and a
cache is created, and the following query comes in, will the cache be used?

Suppose today is 2021/09/01
fq=timelimit:[2021-09-01T00:00:00Z TO 2021-09-08T00:00:00Z]

In other words, even if I create a cache with a special syntax like
NOW/DAY, will the cache be used when requesting the expanded value?

thanks,

Taisuke

Re: The relationship between filter cache and date math syntax

Posted by Taisuke Miyazaki <mi...@lifull.com>.
Thank you.
My problem has been solved.

Taisuke.

2021年9月28日(火) 16:01 Jan Høydahl <ja...@cominvent.com>:

> What gets cached is a long value representing a timestamp.
> So all filter queries need to use the exact same rounding, e.g. NOW/DAY,
> else they won't hit the cache.
>
> Jan
>
> > 28. sep. 2021 kl. 03:37 skrev Taisuke Miyazaki <
> miyazakitaisuke@lifull.com>:
> >
> > Thanks, Markus.
> >
> > However, what I was wondering was whether the cache would work for a
> > mixture of special syntaxes like NOW/HOUR, NOW/DAY, and queries with
> > specific dates, respectively.
> > I'm wondering how it works when the firstSearcher uses NOW/DAY but the
> > actual query is searching for a specific date.
> >
> > Taisuke.
> >
> >
> > 2021年9月27日(月) 20:25 Markus Jelsma <ma...@openindex.io>:
> >
> >> Hello Taisuke,
> >>
> >> NOW is rounded down to the current millisecond and cannot be reused a
> >> millisecond later. You should always round NOW down to the minute or the
> >> hour, or you will pollute the cache.
> >>
> >> For example: date:[NOW-7DAY/HOUR TO NOW/HOUR] is cached and is reusable
> for
> >> at most one hour.
> >>
> >> Regards,
> >> Markus
> >>
> >> Op ma 27 sep. 2021 om 13:15 schreef Taisuke Miyazaki <
> >> miyazakitaisuke@lifull.com>:
> >>
> >>> Hi.
> >>>
> >>> In fistSearcher and newSearcher, you can set up a query to warm up the
> >>> cache.
> >>> So, if I write a query like timelimit:[NOW/DAY TO NOW+7DAYS/DAY] and a
> >>> cache is created, and the following query comes in, will the cache be
> >> used?
> >>>
> >>> Suppose today is 2021/09/01
> >>> fq=timelimit:[2021-09-01T00:00:00Z TO 2021-09-08T00:00:00Z]
> >>>
> >>> In other words, even if I create a cache with a special syntax like
> >>> NOW/DAY, will the cache be used when requesting the expanded value?
> >>>
> >>> thanks,
> >>>
> >>> Taisuke
> >>>
> >>
>
>

Re: The relationship between filter cache and date math syntax

Posted by Jan Høydahl <ja...@cominvent.com>.
What gets cached is a long value representing a timestamp.
So all filter queries need to use the exact same rounding, e.g. NOW/DAY, else they won't hit the cache.

Jan

> 28. sep. 2021 kl. 03:37 skrev Taisuke Miyazaki <mi...@lifull.com>:
> 
> Thanks, Markus.
> 
> However, what I was wondering was whether the cache would work for a
> mixture of special syntaxes like NOW/HOUR, NOW/DAY, and queries with
> specific dates, respectively.
> I'm wondering how it works when the firstSearcher uses NOW/DAY but the
> actual query is searching for a specific date.
> 
> Taisuke.
> 
> 
> 2021年9月27日(月) 20:25 Markus Jelsma <ma...@openindex.io>:
> 
>> Hello Taisuke,
>> 
>> NOW is rounded down to the current millisecond and cannot be reused a
>> millisecond later. You should always round NOW down to the minute or the
>> hour, or you will pollute the cache.
>> 
>> For example: date:[NOW-7DAY/HOUR TO NOW/HOUR] is cached and is reusable for
>> at most one hour.
>> 
>> Regards,
>> Markus
>> 
>> Op ma 27 sep. 2021 om 13:15 schreef Taisuke Miyazaki <
>> miyazakitaisuke@lifull.com>:
>> 
>>> Hi.
>>> 
>>> In fistSearcher and newSearcher, you can set up a query to warm up the
>>> cache.
>>> So, if I write a query like timelimit:[NOW/DAY TO NOW+7DAYS/DAY] and a
>>> cache is created, and the following query comes in, will the cache be
>> used?
>>> 
>>> Suppose today is 2021/09/01
>>> fq=timelimit:[2021-09-01T00:00:00Z TO 2021-09-08T00:00:00Z]
>>> 
>>> In other words, even if I create a cache with a special syntax like
>>> NOW/DAY, will the cache be used when requesting the expanded value?
>>> 
>>> thanks,
>>> 
>>> Taisuke
>>> 
>> 


Re: The relationship between filter cache and date math syntax

Posted by Taisuke Miyazaki <mi...@lifull.com>.
Thanks, Markus.

However, what I was wondering was whether the cache would work for a
mixture of special syntaxes like NOW/HOUR, NOW/DAY, and queries with
specific dates, respectively.
I'm wondering how it works when the firstSearcher uses NOW/DAY but the
actual query is searching for a specific date.

Taisuke.


2021年9月27日(月) 20:25 Markus Jelsma <ma...@openindex.io>:

> Hello Taisuke,
>
> NOW is rounded down to the current millisecond and cannot be reused a
> millisecond later. You should always round NOW down to the minute or the
> hour, or you will pollute the cache.
>
> For example: date:[NOW-7DAY/HOUR TO NOW/HOUR] is cached and is reusable for
> at most one hour.
>
> Regards,
> Markus
>
> Op ma 27 sep. 2021 om 13:15 schreef Taisuke Miyazaki <
> miyazakitaisuke@lifull.com>:
>
> > Hi.
> >
> > In fistSearcher and newSearcher, you can set up a query to warm up the
> > cache.
> > So, if I write a query like timelimit:[NOW/DAY TO NOW+7DAYS/DAY] and a
> > cache is created, and the following query comes in, will the cache be
> used?
> >
> > Suppose today is 2021/09/01
> > fq=timelimit:[2021-09-01T00:00:00Z TO 2021-09-08T00:00:00Z]
> >
> > In other words, even if I create a cache with a special syntax like
> > NOW/DAY, will the cache be used when requesting the expanded value?
> >
> > thanks,
> >
> > Taisuke
> >
>

Re: The relationship between filter cache and date math syntax

Posted by Markus Jelsma <ma...@openindex.io>.
Hello Taisuke,

NOW is rounded down to the current millisecond and cannot be reused a
millisecond later. You should always round NOW down to the minute or the
hour, or you will pollute the cache.

For example: date:[NOW-7DAY/HOUR TO NOW/HOUR] is cached and is reusable for
at most one hour.

Regards,
Markus

Op ma 27 sep. 2021 om 13:15 schreef Taisuke Miyazaki <
miyazakitaisuke@lifull.com>:

> Hi.
>
> In fistSearcher and newSearcher, you can set up a query to warm up the
> cache.
> So, if I write a query like timelimit:[NOW/DAY TO NOW+7DAYS/DAY] and a
> cache is created, and the following query comes in, will the cache be used?
>
> Suppose today is 2021/09/01
> fq=timelimit:[2021-09-01T00:00:00Z TO 2021-09-08T00:00:00Z]
>
> In other words, even if I create a cache with a special syntax like
> NOW/DAY, will the cache be used when requesting the expanded value?
>
> thanks,
>
> Taisuke
>