Well, first of all I would use separate fq clauses. IOW:
 fq=filter(fromfield:[* TO NOW/DAY+1DAY]&& tofield:[NOW/DAY-7DAY TO *]  &&
type:"abc")

would probably be better written as:
 fq=fromfield:[* TO NOW/DAY+1DAY]&fq=tofield:[NOW/DAY-7DAY TO *]&fq=type:"abc"

You can always spoof the * at the _end_ of the cache by putting it at
some date far in the
future, i.e.
fq=fromfield:[some-date TO NOW/DAY+10000000DAYS]

But you can empirically figure this out, just go to the
admin>>core>>plugins/stats
and look at the hits for filterCache when you issue test queries.

Best,
Erick

On Thu, May 5, 2016 at 4:55 PM, Ahmet Arslan <iori...@yahoo.com.invalid> wrote:
> Hi,
>
> It depends on your re-use patterns. Query supplied to the filter query (fq) 
> will be the key of the cache map. Subsequent filter query with an existing 
> key will be served from cache.
>
> For example lets say that you always use these two clauses together.
> Then it makes sense to use fq=+fromfield:[* TO NOW/DAY+1DAY] 
> +tofield:[NOW/DAY-7DAY TO *]
>
> If you have other requests where you filter on type, then separate it: 
> fq=type:abc
>
> It is beter to create smart cache keys that are likely to be issued again.
>
> If type:abc already restricts document space into a very small subset, then 
> you may use post filter option for the remaining restricting clauses.
>
> Ahmet
>
>
> On Friday, May 6, 2016 12:05 AM, Jay Potharaju <jspothar...@gmail.com> wrote:
> I have almost 50 million docs and growing ...that being said in a high
> query volume case does it make sense to use
>
> fq=filter(fromfield:[* TO NOW/DAY+1DAY]&& tofield:[NOW/DAY-7DAY TO *]  &&
> type:"abc")
>
> OR
> fq=filter(fromfield:[* TO NOW/DAY+1DAY]&& tofield:[NOW/DAY-7DAY TO *] )
> fq=filter(type:abc)
>
> Is this something that I would need to determine by running some test
> Thanks
>
> On Thu, May 5, 2016 at 1:44 PM, Jay Potharaju <jspothar...@gmail.com> wrote:
>
>> Are you suggesting rewriting it like this ?
>> fq=filter(fromfield:[* TO NOW/DAY+1DAY]&& tofield:[NOW/DAY-7DAY TO *] )
>> fq=filter(type:abc)
>>
>> Is this a better use of the cache as supposed to fq=fromfield:[* TO
>> NOW/DAY+1DAY]&& tofield:[NOW/DAY-7DAY TO *] && type:"abc"
>>
>> Thanks
>>
>> On Thu, May 5, 2016 at 12:50 PM, Ahmet Arslan <iori...@yahoo.com.invalid>
>> wrote:
>>
>>> Hi,
>>>
>>> Cache enemy is not * but NOW. Since you round it to DAY, cache will work
>>> within-day.
>>> I would use separate filer queries, especially fq=type:abc for the
>>> structured query so it will be cached independently.
>>>
>>> Also consider disabling caching (using cost) in expensive queries:
>>> http://yonik.com/advanced-filter-caching-in-solr/
>>>
>>> Ahmet
>>>
>>>
>>>
>>> On Thursday, May 5, 2016 8:25 PM, Jay Potharaju <jspothar...@gmail.com>
>>> wrote:
>>> Hi,
>>> I have a filter query that gets  documents based on date ranges from last
>>> n
>>> days to anytime in future.
>>>
>>> The objective is to get documents between a date range, but the start date
>>> and end date values are stored in different fields and that is why I wrote
>>> the filter query as below
>>>
>>> fq=fromfield:[* TO NOW/DAY+1DAY]&& tofield:[NOW/DAY-7DAY TO *] &&
>>> type:"abc"
>>>
>>> The way these queries are currently written I think wont leverage the
>>> filter cache because of "*". Is there a better way to write this query so
>>> that I can leverage the cache.
>>>
>>>
>>>
>>> --
>>> Thanks
>>> Jay
>
>>>
>>
>>
>>
>> --
>> Thanks
>> Jay Potharaju
>>
>>
>
>
>
> --
> Thanks
> Jay Potharaju

Reply via email to