Imagine that some of the filters you use in your queries are not good candidates for caching. You may wonder why, for example, those filters have a date and time with seconds or are spatial filters scattered all over the world. Such filters are quite unique and when added to the cache, their entries can't be reused much. Thus they are more or less useless. Caching such filters is a waste of memory and CPU cycles. Is there something you can do to avoid filter queries caching? Yes, there is a way and this recipe will show you how to do it.
Let's assume we have the following query being used to get the information we need:
q=solr+cookbook&fq=category:books&fq=date:2012-06-12T13:22:12Z
The filter query we don't want to cache is the one filtering our documents on the basis of the date
field. Of course, we still want the filtering to be done. In order to turn off caching, we need to add {!cache=false}
to our filter with the date
field, so that our query...